diff --git a/sdk/security/azure-mgmt-security/_meta.json b/sdk/security/azure-mgmt-security/_meta.json index 11ee7f358492..e0b398ded86a 100644 --- a/sdk/security/azure-mgmt-security/_meta.json +++ b/sdk/security/azure-mgmt-security/_meta.json @@ -1,19 +1,19 @@ { - "commit": "5485fc4eb11debd9cc8d92ec156b573998aae977", + "commit": "7b8651bc7a030e18731309e2a691dba20e2d9c63", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.10.2", "use": [ - "@autorest/python@6.13.16", + "@autorest/python@6.19.0", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/security/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.13.16 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "autorest_command": "autorest specification/security/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/security/resource-manager/readme.md", "package-2023-11-15": "2023-09-12 12:04:57 -0700 32c178f2467f792a322f56174be244135d2c907f Microsoft.Security/stable/2023-11-15/apiCollections.json", "package-preview-2023-03-only": "2023-03-23 11:34:42 +0200 2db2beee2fed67b08d273fdac7a51aba02ac2f80 Microsoft.Security/preview/2023-03-01-preview/securityConnectors.json", "package-preview-2023-02-only": "2023-03-10 09:31:28 +0200 a2e2617050e68ae1c445db565076c5a7f42ebad4 Microsoft.Security/preview/2023-02-01-preview/healthReports.json", "package-preview-2023-01-only": "2023-03-28 11:35:29 +0300 0e2c3d175e126284c5db1d3099b61e46e462fb74 Microsoft.Security/preview/2023-01-01-preview/securityOperators.json", "package-2023-01": "2023-03-27 17:16:35 +0300 efd2b52bcf2b06e174f7008b2728f70ee7f972bd Microsoft.Security/stable/2023-01-01/pricings.json", - "package-preview-2022-12": "2023-09-12 22:01:54 +0300 b09b155f738b4178bcfe820f54f8702a94eb9d90 Microsoft.Security/preview/2022-12-01-preview/defenderForStorageSettings.json", + "package-preview-2022-12": "2024-07-01 22:47:55 +0300 be978e57137bfd799e350575c0fdd53511f0e4a8 Microsoft.Security/preview/2022-12-01-preview/defenderForStorageSettings.json", "package-preview-2022-08": "2022-09-20 03:45:43 +0300 9000eea3aa90071c2814f663dd763d7fc1668bed Microsoft.Security/preview/2022-08-01-preview/securityConnectors.json", "package-preview-2022-07": "2022-11-01 04:47:16 +0200 312544c27464f61bf9639924099d4238bdfa1d71 Microsoft.Security/preview/2022-07-01-preview/applications.json", "package-2022-05": "2022-06-09 12:47:24 +0300 d006e1d15d8fe19a6c558861dd5bba6b7baa8dd8 Microsoft.Security/stable/2022-05-01/settings.json", @@ -23,7 +23,7 @@ "package-2022-01-only": "2023-03-02 10:05:39 +0800 c287c0fb1c00df4bb1812acec050d178fa969cb6 Microsoft.Security/stable/2022-01-01/alerts.json", "package-2022-01-preview-only": "2023-01-24 09:46:27 +0200 9eb9c45842ba2932eee57326189019adc3018397 Microsoft.Security/preview/2022-01-01-preview/governanceRules.json", "package-2021-10-preview-only": "2021-10-22 08:18:20 +0300 32652d34b63d39b2c9ca52cf97e2f805b881dd4a Microsoft.Security/preview/2021-10-01-preview/mdeOnboardings.json", - "package-2021-07-preview-only": "2022-02-16 05:25:20 +0200 72808f0e1bef87104ed97735158547422acb3d17 Microsoft.Security/preview/2021-07-01-preview/customAssessmentAutomation.json", + "package-2021-07-preview-only": "2022-02-08 09:36:53 +0200 0b40a820afcd4b8796d27f0d0ac29098804855e5 Microsoft.Security/preview/2021-07-01-preview/securityConnectors.json", "package-2021-07-only": "2022-04-13 06:23:26 +0300 880394b28e0f4e7925f4ecb3edc46b651ab58129 Microsoft.Security/stable/2021-07-01/settings.json", "package-2021-06-only": "2022-04-13 06:23:26 +0300 880394b28e0f4e7925f4ecb3edc46b651ab58129 Microsoft.Security/stable/2021-06-01/settings.json", "package-2021-05-preview-only": "2021-05-20 10:54:13 +0300 5fcc6854765009e891052653b304cfe80353430a Microsoft.Security/preview/2021-05-01-preview/softwareInventories.json", diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/_security_center.py index b02dcbe37e5e..3a86f8479048 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/_security_center.py @@ -10,6 +10,7 @@ # -------------------------------------------------------------------------- from typing import Any, Optional, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.mgmt.core import ARMPipelineClient @@ -60,8 +61,6 @@ class SecurityCenter(MultiApiClientMixin, _SDKClient): LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { None: DEFAULT_API_VERSION, - 'adaptive_application_controls': '2020-01-01', - 'adaptive_network_hardenings': '2020-01-01', 'advanced_threat_protection': '2019-01-01', 'alerts': '2022-01-01', 'alerts_suppression_rules': '2019-01-01-preview', @@ -79,8 +78,6 @@ class SecurityCenter(MultiApiClientMixin, _SDKClient): 'compliance_results': '2017-08-01', 'compliances': '2017-08-01-preview', 'connectors': '2020-01-01-preview', - 'custom_assessment_automations': '2021-07-01-preview', - 'custom_entity_store_assignments': '2021-07-01-preview', 'defender_for_storage': '2022-12-01-preview', 'device_security_groups': '2019-08-01', 'discovered_security_solutions': '2020-01-01', @@ -323,34 +320,6 @@ def models(cls, api_version=DEFAULT_API_VERSION): return models raise ValueError("API version {} is not available".format(api_version)) - @property - def adaptive_application_controls(self): - """Instance depends on the API version: - - * 2020-01-01: :class:`AdaptiveApplicationControlsOperations` - """ - api_version = self._get_api_version('adaptive_application_controls') - if api_version == '2020-01-01': - from .v2020_01_01.operations import AdaptiveApplicationControlsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'adaptive_application_controls'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def adaptive_network_hardenings(self): - """Instance depends on the API version: - - * 2020-01-01: :class:`AdaptiveNetworkHardeningsOperations` - """ - api_version = self._get_api_version('adaptive_network_hardenings') - if api_version == '2020-01-01': - from .v2020_01_01.operations import AdaptiveNetworkHardeningsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'adaptive_network_hardenings'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - @property def advanced_threat_protection(self): """Instance depends on the API version: @@ -649,34 +618,6 @@ def connectors(self): self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - @property - def custom_assessment_automations(self): - """Instance depends on the API version: - - * 2021-07-01-preview: :class:`CustomAssessmentAutomationsOperations` - """ - api_version = self._get_api_version('custom_assessment_automations') - if api_version == '2021-07-01-preview': - from .v2021_07_01_preview.operations import CustomAssessmentAutomationsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'custom_assessment_automations'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def custom_entity_store_assignments(self): - """Instance depends on the API version: - - * 2021-07-01-preview: :class:`CustomEntityStoreAssignmentsOperations` - """ - api_version = self._get_api_version('custom_entity_store_assignments') - if api_version == '2021-07-01-preview': - from .v2021_07_01_preview.operations import CustomEntityStoreAssignmentsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'custom_entity_store_assignments'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - @property def defender_for_storage(self): """Instance depends on the API version: diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/_serialization.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/_serialization.py index 75e26c415d2c..59f1fcf71bc9 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/_serialization.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/_serialization.py @@ -144,6 +144,8 @@ def _json_attemp(data): # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -1447,7 +1449,7 @@ def _deserialize(self, target_obj, data): elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) - if data is None: + if data is None or data is CoreNull: return data try: attributes = response._attribute_map # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/_security_center.py index d39f0414d90e..3832e586fd87 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/aio/_security_center.py @@ -10,6 +10,7 @@ # -------------------------------------------------------------------------- from typing import Any, Optional, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.mgmt.core import AsyncARMPipelineClient @@ -60,8 +61,6 @@ class SecurityCenter(MultiApiClientMixin, _SDKClient): LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { None: DEFAULT_API_VERSION, - 'adaptive_application_controls': '2020-01-01', - 'adaptive_network_hardenings': '2020-01-01', 'advanced_threat_protection': '2019-01-01', 'alerts': '2022-01-01', 'alerts_suppression_rules': '2019-01-01-preview', @@ -79,8 +78,6 @@ class SecurityCenter(MultiApiClientMixin, _SDKClient): 'compliance_results': '2017-08-01', 'compliances': '2017-08-01-preview', 'connectors': '2020-01-01-preview', - 'custom_assessment_automations': '2021-07-01-preview', - 'custom_entity_store_assignments': '2021-07-01-preview', 'defender_for_storage': '2022-12-01-preview', 'device_security_groups': '2019-08-01', 'discovered_security_solutions': '2020-01-01', @@ -323,34 +320,6 @@ def models(cls, api_version=DEFAULT_API_VERSION): return models raise ValueError("API version {} is not available".format(api_version)) - @property - def adaptive_application_controls(self): - """Instance depends on the API version: - - * 2020-01-01: :class:`AdaptiveApplicationControlsOperations` - """ - api_version = self._get_api_version('adaptive_application_controls') - if api_version == '2020-01-01': - from ..v2020_01_01.aio.operations import AdaptiveApplicationControlsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'adaptive_application_controls'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def adaptive_network_hardenings(self): - """Instance depends on the API version: - - * 2020-01-01: :class:`AdaptiveNetworkHardeningsOperations` - """ - api_version = self._get_api_version('adaptive_network_hardenings') - if api_version == '2020-01-01': - from ..v2020_01_01.aio.operations import AdaptiveNetworkHardeningsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'adaptive_network_hardenings'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - @property def advanced_threat_protection(self): """Instance depends on the API version: @@ -649,34 +618,6 @@ def connectors(self): self._config.api_version = api_version return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - @property - def custom_assessment_automations(self): - """Instance depends on the API version: - - * 2021-07-01-preview: :class:`CustomAssessmentAutomationsOperations` - """ - api_version = self._get_api_version('custom_assessment_automations') - if api_version == '2021-07-01-preview': - from ..v2021_07_01_preview.aio.operations import CustomAssessmentAutomationsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'custom_assessment_automations'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def custom_entity_store_assignments(self): - """Instance depends on the API version: - - * 2021-07-01-preview: :class:`CustomEntityStoreAssignmentsOperations` - """ - api_version = self._get_api_version('custom_entity_store_assignments') - if api_version == '2021-07-01-preview': - from ..v2021_07_01_preview.aio.operations import CustomEntityStoreAssignmentsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'custom_entity_store_assignments'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - @property def defender_for_storage(self): """Instance depends on the API version: diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/models.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/models.py index 030994ed6062..cfeabfba9249 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/models.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/models.py @@ -14,7 +14,6 @@ from .v2020_01_01_preview.models import * from .v2021_05_01_preview.models import * from .v2021_06_01.models import * -from .v2021_07_01_preview.models import * from .v2021_10_01_preview.models import * from .v2022_01_01.models import * from .v2022_01_01_preview.models import * diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_metadata.json index 3d6f68e3fc51..7e69e64ca633 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_security_center.py index 44e7188ee52a..b67c3edaa287 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -111,7 +112,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SecurityCenter": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_vendor.py +++ /dev/null @@ -1,16 +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 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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/_security_center.py index fc3c83b06f67..caa73ede1199 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -113,7 +114,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SecurityCenter": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_locations_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_locations_operations.py index a0c934299dbe..5759075f2666 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_locations_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_locations_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._locations_operations import build_get_request, build_list_request if sys.version_info >= (3, 9): @@ -95,7 +93,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -111,7 +108,6 @@ def prepare_request(next_link=None): _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 @@ -174,7 +170,6 @@ async def get(self, asc_location: str, **kwargs: Any) -> _models.AscLocation: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -188,7 +183,7 @@ async def get(self, asc_location: str, **kwargs: Any) -> _models.AscLocation: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AscLocation", pipeline_response) + deserialized = self._deserialize("AscLocation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_operations.py index 3f7df101e850..a0bdf402cdb2 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 from ...operations._operations import build_list_request if sys.version_info >= (3, 9): @@ -91,7 +89,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -107,7 +104,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_tasks_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_tasks_operations.py index 9af26e4cb888..1b75a00044ec 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_tasks_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/aio/operations/_tasks_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._tasks_operations import ( build_get_resource_group_level_task_request, build_get_subscription_level_task_request, @@ -104,7 +102,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -120,7 +117,6 @@ def prepare_request(next_link=None): _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 @@ -192,7 +188,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -208,7 +203,6 @@ def prepare_request(next_link=None): _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 @@ -276,7 +270,6 @@ async def get_subscription_level_task( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -290,7 +283,7 @@ async def get_subscription_level_task( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityTask", pipeline_response) + deserialized = self._deserialize("SecurityTask", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -345,7 +338,6 @@ async def update_subscription_level_task_state( # pylint: disable=inconsistent- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -409,7 +401,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -425,7 +416,6 @@ def prepare_request(next_link=None): _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 @@ -497,7 +487,6 @@ async def get_resource_group_level_task( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -511,7 +500,7 @@ async def get_resource_group_level_task( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityTask", pipeline_response) + deserialized = self._deserialize("SecurityTask", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -571,7 +560,6 @@ async def update_resource_group_level_task_state( # pylint: disable=inconsisten headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_locations_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_locations_operations.py index 74a717113d83..03ef035d7edc 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_locations_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_locations_operations.py @@ -20,15 +20,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -152,7 +150,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -168,7 +165,6 @@ def prepare_request(next_link=None): _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 @@ -231,7 +227,6 @@ def get(self, asc_location: str, **kwargs: Any) -> _models.AscLocation: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -245,7 +240,7 @@ def get(self, asc_location: str, **kwargs: Any) -> _models.AscLocation: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AscLocation", pipeline_response) + deserialized = self._deserialize("AscLocation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_operations.py index e222fbae6559..4d9a68c51f19 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_operations.py @@ -20,15 +20,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -112,7 +110,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -128,7 +125,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_tasks_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_tasks_operations.py index b5bd0c828ec4..8f9e40e159e4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_tasks_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2015_06_01_preview/operations/_tasks_operations.py @@ -20,15 +20,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -345,7 +343,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -361,7 +358,6 @@ def prepare_request(next_link=None): _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 @@ -433,7 +429,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -449,7 +444,6 @@ def prepare_request(next_link=None): _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 @@ -515,7 +509,6 @@ def get_subscription_level_task(self, asc_location: str, task_name: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -529,7 +522,7 @@ def get_subscription_level_task(self, asc_location: str, task_name: str, **kwarg map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityTask", pipeline_response) + deserialized = self._deserialize("SecurityTask", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -584,7 +577,6 @@ def update_subscription_level_task_state( # pylint: disable=inconsistent-return headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -648,7 +640,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -664,7 +655,6 @@ def prepare_request(next_link=None): _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 @@ -736,7 +726,6 @@ def get_resource_group_level_task( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -750,7 +739,7 @@ def get_resource_group_level_task( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityTask", pipeline_response) + deserialized = self._deserialize("SecurityTask", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -810,7 +799,6 @@ def update_resource_group_level_task_state( # pylint: disable=inconsistent-retu headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_metadata.json index 1c216d71524c..2b42fa98b20f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_security_center.py index 3f4156e5140c..b26119182bcc 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -96,7 +97,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SecurityCenter": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_vendor.py +++ /dev/null @@ -1,16 +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 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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/_security_center.py index 3875631b52e3..a7184b59d652 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -98,7 +99,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SecurityCenter": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/operations/_compliance_results_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/operations/_compliance_results_operations.py index 662e7ffd3028..c0f650c90c44 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/operations/_compliance_results_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/aio/operations/_compliance_results_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._compliance_results_operations import build_get_request, build_list_request if sys.version_info >= (3, 9): @@ -95,7 +93,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -111,7 +108,6 @@ def prepare_request(next_link=None): _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 @@ -173,7 +169,6 @@ async def get(self, resource_id: str, compliance_result_name: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -187,7 +182,7 @@ async def get(self, resource_id: str, compliance_result_name: str, **kwargs: Any map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ComplianceResult", pipeline_response) + deserialized = self._deserialize("ComplianceResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/operations/_compliance_results_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/operations/_compliance_results_operations.py index 4bb1b65ebcc2..46ce47ca7556 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/operations/_compliance_results_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01/operations/_compliance_results_operations.py @@ -20,15 +20,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -147,7 +145,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -163,7 +160,6 @@ def prepare_request(next_link=None): _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 @@ -225,7 +221,6 @@ def get(self, resource_id: str, compliance_result_name: str, **kwargs: Any) -> _ headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -239,7 +234,7 @@ def get(self, resource_id: str, compliance_result_name: str, **kwargs: Any) -> _ map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ComplianceResult", pipeline_response) + deserialized = self._deserialize("ComplianceResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_metadata.json index 733248692d31..e84e2e58c0d7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_security_center.py index 5fe4cb43ffe1..b8c82770ffae 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -131,7 +132,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SecurityCenter": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_vendor.py +++ /dev/null @@ -1,16 +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 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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/_security_center.py index beaf99ad432d..012949c38a68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -134,7 +135,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SecurityCenter": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_auto_provisioning_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_auto_provisioning_settings_operations.py index 7af435870697..55a37c327b71 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_auto_provisioning_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_auto_provisioning_settings_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._auto_provisioning_settings_operations import ( build_create_request, build_get_request, @@ -99,7 +97,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -115,7 +112,6 @@ def prepare_request(next_link=None): _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 @@ -177,7 +173,6 @@ async def get(self, setting_name: str, **kwargs: Any) -> _models.AutoProvisionin headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -191,7 +186,7 @@ async def get(self, setting_name: str, **kwargs: Any) -> _models.AutoProvisionin map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AutoProvisioningSetting", pipeline_response) + deserialized = self._deserialize("AutoProvisioningSetting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -290,7 +285,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -304,7 +298,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AutoProvisioningSetting", pipeline_response) + deserialized = self._deserialize("AutoProvisioningSetting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_compliances_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_compliances_operations.py index 72178e77a83d..e74cd86790ff 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_compliances_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_compliances_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._compliances_operations import build_get_request, build_list_request if sys.version_info >= (3, 9): @@ -97,7 +95,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -113,7 +110,6 @@ def prepare_request(next_link=None): _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 @@ -179,7 +175,6 @@ async def get(self, scope: str, compliance_name: str, **kwargs: Any) -> _models. headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -193,7 +188,7 @@ async def get(self, scope: str, compliance_name: str, **kwargs: Any) -> _models. map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Compliance", pipeline_response) + deserialized = self._deserialize("Compliance", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_information_protection_policies_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_information_protection_policies_operations.py index c48dfcddb8d0..cc08ab7bb29c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_information_protection_policies_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_information_protection_policies_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._information_protection_policies_operations import ( build_create_or_update_request, build_get_request, @@ -108,7 +106,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -122,7 +119,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("InformationProtectionPolicy", pipeline_response) + deserialized = self._deserialize("InformationProtectionPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -251,7 +248,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -265,11 +261,7 @@ async def create_or_update( 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("InformationProtectionPolicy", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("InformationProtectionPolicy", pipeline_response) + deserialized = self._deserialize("InformationProtectionPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -315,7 +307,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -331,7 +322,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_security_contacts_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_security_contacts_operations.py index 4a0948c6e4d7..49bc2c3356a3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_security_contacts_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_security_contacts_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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_contacts_operations import ( build_create_request, build_delete_request, @@ -100,7 +98,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -116,7 +113,6 @@ def prepare_request(next_link=None): _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 @@ -178,7 +174,6 @@ async def get(self, security_contact_name: str, **kwargs: Any) -> _models.Securi headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -192,7 +187,7 @@ async def get(self, security_contact_name: str, **kwargs: Any) -> _models.Securi map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityContact", pipeline_response) + deserialized = self._deserialize("SecurityContact", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -296,7 +291,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -310,7 +304,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityContact", pipeline_response) + deserialized = self._deserialize("SecurityContact", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -352,7 +346,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -466,7 +459,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -480,7 +472,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityContact", pipeline_response) + deserialized = self._deserialize("SecurityContact", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_workspace_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_workspace_settings_operations.py index 7dfb04538942..7a7040956c04 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_workspace_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/aio/operations/_workspace_settings_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._workspace_settings_operations import ( build_create_request, build_delete_request, @@ -101,7 +99,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -117,7 +114,6 @@ def prepare_request(next_link=None): _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 @@ -180,7 +176,6 @@ async def get(self, workspace_setting_name: str, **kwargs: Any) -> _models.Works headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -194,7 +189,7 @@ async def get(self, workspace_setting_name: str, **kwargs: Any) -> _models.Works map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkspaceSetting", pipeline_response) + deserialized = self._deserialize("WorkspaceSetting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -298,7 +293,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -312,7 +306,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkspaceSetting", pipeline_response) + deserialized = self._deserialize("WorkspaceSetting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -416,7 +410,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -430,7 +423,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkspaceSetting", pipeline_response) + deserialized = self._deserialize("WorkspaceSetting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -473,7 +466,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_auto_provisioning_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_auto_provisioning_settings_operations.py index c69ae126f0e6..97a4464521fe 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_auto_provisioning_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_auto_provisioning_settings_operations.py @@ -21,15 +21,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -188,7 +186,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -204,7 +201,6 @@ def prepare_request(next_link=None): _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 @@ -266,7 +262,6 @@ def get(self, setting_name: str, **kwargs: Any) -> _models.AutoProvisioningSetti headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -280,7 +275,7 @@ def get(self, setting_name: str, **kwargs: Any) -> _models.AutoProvisioningSetti map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AutoProvisioningSetting", pipeline_response) + deserialized = self._deserialize("AutoProvisioningSetting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -379,7 +374,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -393,7 +387,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AutoProvisioningSetting", pipeline_response) + deserialized = self._deserialize("AutoProvisioningSetting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_compliances_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_compliances_operations.py index c7e3fdf6ea26..b73c30cefcfb 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_compliances_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_compliances_operations.py @@ -20,15 +20,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -148,7 +146,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -164,7 +161,6 @@ def prepare_request(next_link=None): _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 @@ -230,7 +226,6 @@ def get(self, scope: str, compliance_name: str, **kwargs: Any) -> _models.Compli headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -244,7 +239,7 @@ def get(self, scope: str, compliance_name: str, **kwargs: Any) -> _models.Compli map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Compliance", pipeline_response) + deserialized = self._deserialize("Compliance", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_information_protection_policies_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_information_protection_policies_operations.py index 3889b481b5a0..b19554fff990 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_information_protection_policies_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_information_protection_policies_operations.py @@ -21,15 +21,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -197,7 +195,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -211,7 +208,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("InformationProtectionPolicy", pipeline_response) + deserialized = self._deserialize("InformationProtectionPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -340,7 +337,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -354,11 +350,7 @@ def create_or_update( 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("InformationProtectionPolicy", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("InformationProtectionPolicy", pipeline_response) + deserialized = self._deserialize("InformationProtectionPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -404,7 +396,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -420,7 +411,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_security_contacts_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_security_contacts_operations.py index 1c7290f3985d..3a9cd76fe5ed 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_security_contacts_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_security_contacts_operations.py @@ -21,15 +21,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -248,7 +246,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -264,7 +261,6 @@ def prepare_request(next_link=None): _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 @@ -326,7 +322,6 @@ def get(self, security_contact_name: str, **kwargs: Any) -> _models.SecurityCont headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -340,7 +335,7 @@ def get(self, security_contact_name: str, **kwargs: Any) -> _models.SecurityCont map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityContact", pipeline_response) + deserialized = self._deserialize("SecurityContact", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -444,7 +439,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -458,7 +452,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityContact", pipeline_response) + deserialized = self._deserialize("SecurityContact", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -500,7 +494,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -614,7 +607,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -628,7 +620,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityContact", pipeline_response) + deserialized = self._deserialize("SecurityContact", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_workspace_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_workspace_settings_operations.py index 2de17cbc2d9c..153abe8bc15c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_workspace_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2017_08_01_preview/operations/_workspace_settings_operations.py @@ -21,15 +21,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -249,7 +247,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -265,7 +262,6 @@ def prepare_request(next_link=None): _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 @@ -328,7 +324,6 @@ def get(self, workspace_setting_name: str, **kwargs: Any) -> _models.WorkspaceSe headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -342,7 +337,7 @@ def get(self, workspace_setting_name: str, **kwargs: Any) -> _models.WorkspaceSe map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkspaceSetting", pipeline_response) + deserialized = self._deserialize("WorkspaceSetting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -446,7 +441,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -460,7 +454,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkspaceSetting", pipeline_response) + deserialized = self._deserialize("WorkspaceSetting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -564,7 +558,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -578,7 +571,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("WorkspaceSetting", pipeline_response) + deserialized = self._deserialize("WorkspaceSetting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -621,7 +614,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_metadata.json index 39ad3a4ea72a..08a798e9c439 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_security_center.py index e5bd462fd96e..14efc0fd4c1e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -99,7 +100,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SecurityCenter": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_vendor.py +++ /dev/null @@ -1,16 +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 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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/_security_center.py index 713cc96f6cfe..b82684707056 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -101,7 +102,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SecurityCenter": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/operations/_pricings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/operations/_pricings_operations.py index 0248ae2f08df..7cc13777d2f6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/operations/_pricings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/aio/operations/_pricings_operations.py @@ -19,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 -from ..._vendor import _convert_request from ...operations._pricings_operations import build_get_request, build_list_request, build_update_request if sys.version_info >= (3, 9): @@ -85,7 +83,6 @@ async def list(self, **kwargs: Any) -> _models.PricingList: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -99,7 +96,7 @@ async def list(self, **kwargs: Any) -> _models.PricingList: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PricingList", pipeline_response) + deserialized = self._deserialize("PricingList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -137,7 +134,6 @@ async def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -151,7 +147,7 @@ async def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Pricing", pipeline_response) + deserialized = self._deserialize("Pricing", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -241,7 +237,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -255,7 +250,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Pricing", pipeline_response) + deserialized = self._deserialize("Pricing", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/operations/_pricings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/operations/_pricings_operations.py index 42bcc7df4229..06b1412bc64c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/operations/_pricings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2018_06_01/operations/_pricings_operations.py @@ -19,15 +19,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -175,7 +173,6 @@ def list(self, **kwargs: Any) -> _models.PricingList: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -189,7 +186,7 @@ def list(self, **kwargs: Any) -> _models.PricingList: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PricingList", pipeline_response) + deserialized = self._deserialize("PricingList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -227,7 +224,6 @@ def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -241,7 +237,7 @@ def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Pricing", pipeline_response) + deserialized = self._deserialize("Pricing", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -329,7 +325,6 @@ def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO[bytes]], headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -343,7 +338,7 @@ def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO[bytes]], map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Pricing", pipeline_response) + deserialized = self._deserialize("Pricing", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_metadata.json index 54dfbbdaf19d..d2e9ddb936a7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_security_center.py index fdf23e790666..04a9f2b86746 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -96,7 +97,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SecurityCenter": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_vendor.py +++ /dev/null @@ -1,16 +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 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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/_security_center.py index 655477ec0eb0..3698b891bf86 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -98,7 +99,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SecurityCenter": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/operations/_advanced_threat_protection_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/operations/_advanced_threat_protection_operations.py index b5551ce2b964..510b90d27be2 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/operations/_advanced_threat_protection_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/aio/operations/_advanced_threat_protection_operations.py @@ -19,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 -from ..._vendor import _convert_request from ...operations._advanced_threat_protection_operations import build_create_request, build_get_request if sys.version_info >= (3, 9): @@ -89,7 +87,6 @@ async def get(self, resource_id: str, **kwargs: Any) -> _models.AdvancedThreatPr headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -103,7 +100,7 @@ async def get(self, resource_id: str, **kwargs: Any) -> _models.AdvancedThreatPr map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AdvancedThreatProtectionSetting", pipeline_response) + deserialized = self._deserialize("AdvancedThreatProtectionSetting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -210,7 +207,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -224,7 +220,7 @@ async def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AdvancedThreatProtectionSetting", pipeline_response) + deserialized = self._deserialize("AdvancedThreatProtectionSetting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/operations/_advanced_threat_protection_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/operations/_advanced_threat_protection_operations.py index 5ca8dfa3b87e..3617180c9269 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/operations/_advanced_threat_protection_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01/operations/_advanced_threat_protection_operations.py @@ -19,15 +19,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -151,7 +149,6 @@ def get(self, resource_id: str, **kwargs: Any) -> _models.AdvancedThreatProtecti headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -165,7 +162,7 @@ def get(self, resource_id: str, **kwargs: Any) -> _models.AdvancedThreatProtecti map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AdvancedThreatProtectionSetting", pipeline_response) + deserialized = self._deserialize("AdvancedThreatProtectionSetting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -272,7 +269,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -286,7 +282,7 @@ def create( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AdvancedThreatProtectionSetting", pipeline_response) + deserialized = self._deserialize("AdvancedThreatProtectionSetting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_metadata.json index 49d773ee4f05..88ef20bd4174 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_security_center.py index e33a4003ec97..67d29d61a557 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -138,7 +139,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SecurityCenter": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_vendor.py +++ /dev/null @@ -1,16 +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 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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/_security_center.py index eba72f0d7aa4..3da1d0ff92fd 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -141,7 +142,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SecurityCenter": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_alerts_suppression_rules_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_alerts_suppression_rules_operations.py index c1a7aeff0bf4..ebd34945d793 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_alerts_suppression_rules_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_alerts_suppression_rules_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._alerts_suppression_rules_operations import ( build_delete_request, build_get_request, @@ -103,7 +101,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -119,7 +116,6 @@ def prepare_request(next_link=None): _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 @@ -181,7 +177,6 @@ async def get(self, alerts_suppression_rule_name: str, **kwargs: Any) -> _models headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -195,7 +190,7 @@ async def get(self, alerts_suppression_rule_name: str, **kwargs: Any) -> _models map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AlertsSuppressionRule", pipeline_response) + deserialized = self._deserialize("AlertsSuppressionRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -303,7 +298,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -317,7 +311,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AlertsSuppressionRule", pipeline_response) + deserialized = self._deserialize("AlertsSuppressionRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -359,7 +353,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_automations_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_automations_operations.py index a1b00c81e800..0605fc540c59 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_automations_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_automations_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._automations_operations import ( build_create_or_update_request, build_delete_request, @@ -102,7 +100,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -118,7 +115,6 @@ def prepare_request(next_link=None): _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 @@ -186,7 +182,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -202,7 +197,6 @@ def prepare_request(next_link=None): _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 @@ -268,7 +262,6 @@ async def get(self, resource_group_name: str, automation_name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -282,7 +275,7 @@ async def get(self, resource_group_name: str, automation_name: str, **kwargs: An map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Automation", pipeline_response) + deserialized = self._deserialize("Automation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -404,7 +397,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -418,11 +410,7 @@ async def create_or_update( 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("Automation", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Automation", pipeline_response) + deserialized = self._deserialize("Automation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -468,7 +456,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -600,7 +587,6 @@ async def validate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -614,7 +600,7 @@ async def validate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AutomationValidationStatus", pipeline_response) + deserialized = self._deserialize("AutomationValidationStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_assessments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_assessments_operations.py index dfd001a27fb6..5e589a2e900d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_assessments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_assessments_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._regulatory_compliance_assessments_operations import build_get_request, build_list_request if sys.version_info >= (3, 9): @@ -111,7 +109,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -127,7 +124,6 @@ def prepare_request(next_link=None): _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 @@ -204,7 +200,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -218,7 +213,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RegulatoryComplianceAssessment", pipeline_response) + deserialized = self._deserialize("RegulatoryComplianceAssessment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_controls_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_controls_operations.py index aa4f01f9f4f4..0684c95d1fae 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_controls_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_controls_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._regulatory_compliance_controls_operations import build_get_request, build_list_request if sys.version_info >= (3, 9): @@ -103,7 +101,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -119,7 +116,6 @@ def prepare_request(next_link=None): _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 @@ -188,7 +184,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -202,7 +197,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RegulatoryComplianceControl", pipeline_response) + deserialized = self._deserialize("RegulatoryComplianceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_standards_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_standards_operations.py index 544410471f2b..a4c66586d6e0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_standards_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_regulatory_compliance_standards_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._regulatory_compliance_standards_operations import build_get_request, build_list_request if sys.version_info >= (3, 9): @@ -99,7 +97,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -115,7 +112,6 @@ def prepare_request(next_link=None): _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 @@ -180,7 +176,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -194,7 +189,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RegulatoryComplianceStandard", pipeline_response) + deserialized = self._deserialize("RegulatoryComplianceStandard", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_sub_assessments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_sub_assessments_operations.py index 02f4788fd362..d2962d3dcac9 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_sub_assessments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/aio/operations/_sub_assessments_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._sub_assessments_operations import build_get_request, build_list_all_request, build_list_request if sys.version_info >= (3, 9): @@ -98,7 +96,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -114,7 +111,6 @@ def prepare_request(next_link=None): _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 @@ -185,7 +181,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -201,7 +196,6 @@ def prepare_request(next_link=None): _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 @@ -273,7 +267,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -287,7 +280,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecuritySubAssessment", pipeline_response) + deserialized = self._deserialize("SecuritySubAssessment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_alerts_suppression_rules_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_alerts_suppression_rules_operations.py index e7d802bfd824..fdf9ccb28a8b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_alerts_suppression_rules_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_alerts_suppression_rules_operations.py @@ -21,15 +21,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -229,7 +227,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -245,7 +242,6 @@ def prepare_request(next_link=None): _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 @@ -307,7 +303,6 @@ def get(self, alerts_suppression_rule_name: str, **kwargs: Any) -> _models.Alert headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -321,7 +316,7 @@ def get(self, alerts_suppression_rule_name: str, **kwargs: Any) -> _models.Alert map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AlertsSuppressionRule", pipeline_response) + deserialized = self._deserialize("AlertsSuppressionRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -429,7 +424,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -443,7 +437,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AlertsSuppressionRule", pipeline_response) + deserialized = self._deserialize("AlertsSuppressionRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -485,7 +479,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_automations_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_automations_operations.py index 7824d626d840..02205d8c3c25 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_automations_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_automations_operations.py @@ -21,15 +21,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -301,7 +299,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -317,7 +314,6 @@ def prepare_request(next_link=None): _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 @@ -385,7 +381,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -401,7 +396,6 @@ def prepare_request(next_link=None): _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 @@ -467,7 +461,6 @@ def get(self, resource_group_name: str, automation_name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -481,7 +474,7 @@ def get(self, resource_group_name: str, automation_name: str, **kwargs: Any) -> map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Automation", pipeline_response) + deserialized = self._deserialize("Automation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -603,7 +596,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -617,11 +609,7 @@ def create_or_update( 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("Automation", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Automation", pipeline_response) + deserialized = self._deserialize("Automation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -667,7 +655,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -799,7 +786,6 @@ def validate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -813,7 +799,7 @@ def validate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AutomationValidationStatus", pipeline_response) + deserialized = self._deserialize("AutomationValidationStatus", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_assessments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_assessments_operations.py index 14e9c57ff138..349b17199720 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_assessments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_assessments_operations.py @@ -20,15 +20,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -201,7 +199,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -217,7 +214,6 @@ def prepare_request(next_link=None): _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 @@ -294,7 +290,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -308,7 +303,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RegulatoryComplianceAssessment", pipeline_response) + deserialized = self._deserialize("RegulatoryComplianceAssessment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_controls_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_controls_operations.py index 97db724137b0..fa9ff5b73c2f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_controls_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_controls_operations.py @@ -20,15 +20,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -181,7 +179,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -197,7 +194,6 @@ def prepare_request(next_link=None): _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 @@ -266,7 +262,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -280,7 +275,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RegulatoryComplianceControl", pipeline_response) + deserialized = self._deserialize("RegulatoryComplianceControl", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_standards_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_standards_operations.py index 8285e81d7849..1ccc1bb73a46 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_standards_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_regulatory_compliance_standards_operations.py @@ -20,15 +20,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -161,7 +159,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -177,7 +174,6 @@ def prepare_request(next_link=None): _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 @@ -240,7 +236,6 @@ def get(self, regulatory_compliance_standard_name: str, **kwargs: Any) -> _model headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -254,7 +249,7 @@ def get(self, regulatory_compliance_standard_name: str, **kwargs: Any) -> _model map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RegulatoryComplianceStandard", pipeline_response) + deserialized = self._deserialize("RegulatoryComplianceStandard", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_sub_assessments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_sub_assessments_operations.py index 8162cfc4d514..1feea4efff62 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_sub_assessments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_01_01_preview/operations/_sub_assessments_operations.py @@ -20,15 +20,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -180,7 +178,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -196,7 +193,6 @@ def prepare_request(next_link=None): _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 @@ -267,7 +263,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -283,7 +278,6 @@ def prepare_request(next_link=None): _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 @@ -355,7 +349,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -369,7 +362,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecuritySubAssessment", pipeline_response) + deserialized = self._deserialize("SecuritySubAssessment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_metadata.json index c497fc6fdd82..41fe9995600e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_security_center.py index 9fc276454ff7..e8818fa5dd37 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -134,7 +135,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SecurityCenter": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_vendor.py +++ /dev/null @@ -1,16 +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 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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/_security_center.py index b3565753ce47..36abec66fa77 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -136,7 +137,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SecurityCenter": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_device_security_groups_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_device_security_groups_operations.py index 00115af76de1..6ca48701a491 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_device_security_groups_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_device_security_groups_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._device_security_groups_operations import ( build_create_or_update_request, build_delete_request, @@ -99,7 +97,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -115,7 +112,6 @@ def prepare_request(next_link=None): _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 @@ -180,7 +176,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -194,7 +189,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeviceSecurityGroup", pipeline_response) + deserialized = self._deserialize("DeviceSecurityGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -314,7 +309,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -328,11 +322,7 @@ async def create_or_update( 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("DeviceSecurityGroup", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("DeviceSecurityGroup", pipeline_response) + deserialized = self._deserialize("DeviceSecurityGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -375,7 +365,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solution_analytics_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solution_analytics_operations.py index b48d661a04e6..20c3b9d5ef3e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solution_analytics_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solution_analytics_operations.py @@ -18,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 -from ..._vendor import _convert_request from ...operations._iot_security_solution_analytics_operations import build_get_request, build_list_request if sys.version_info >= (3, 9): @@ -93,7 +91,6 @@ async def list( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -107,7 +104,7 @@ async def list( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("IoTSecuritySolutionAnalyticsModelList", pipeline_response) + deserialized = self._deserialize("IoTSecuritySolutionAnalyticsModelList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -151,7 +148,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -165,7 +161,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("IoTSecuritySolutionAnalyticsModel", pipeline_response) + deserialized = self._deserialize("IoTSecuritySolutionAnalyticsModel", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solution_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solution_operations.py index cee2b4986f67..9eadd71145f8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solution_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solution_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._iot_security_solution_operations import ( build_create_or_update_request, build_delete_request, @@ -106,7 +104,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -122,7 +119,6 @@ def prepare_request(next_link=None): _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 @@ -194,7 +190,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -210,7 +205,6 @@ def prepare_request(next_link=None): _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 @@ -276,7 +270,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -290,7 +283,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("IoTSecuritySolutionModel", pipeline_response) + deserialized = self._deserialize("IoTSecuritySolutionModel", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -409,7 +402,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -423,11 +415,7 @@ async def create_or_update( 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("IoTSecuritySolutionModel", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("IoTSecuritySolutionModel", pipeline_response) + deserialized = self._deserialize("IoTSecuritySolutionModel", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -549,7 +537,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -563,7 +550,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("IoTSecuritySolutionModel", pipeline_response) + deserialized = self._deserialize("IoTSecuritySolutionModel", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -607,7 +594,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solutions_analytics_aggregated_alert_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solutions_analytics_aggregated_alert_operations.py index 170fa2b896b3..6ed877fd4168 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solutions_analytics_aggregated_alert_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solutions_analytics_aggregated_alert_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._iot_security_solutions_analytics_aggregated_alert_operations import ( build_dismiss_request, build_get_request, @@ -108,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -124,7 +121,6 @@ def prepare_request(next_link=None): _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 @@ -194,7 +190,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -208,7 +203,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("IoTSecurityAggregatedAlert", pipeline_response) + deserialized = self._deserialize("IoTSecurityAggregatedAlert", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -255,7 +250,6 @@ async def dismiss( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solutions_analytics_recommendation_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solutions_analytics_recommendation_operations.py index 009d7d84fa6d..e09af0682b6c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solutions_analytics_recommendation_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/aio/operations/_iot_security_solutions_analytics_recommendation_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._iot_security_solutions_analytics_recommendation_operations import ( build_get_request, build_list_request, @@ -104,7 +102,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -118,7 +115,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("IoTSecurityAggregatedRecommendation", pipeline_response) + deserialized = self._deserialize("IoTSecurityAggregatedRecommendation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -171,7 +168,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -187,7 +183,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_device_security_groups_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_device_security_groups_operations.py index 88fd7ad9b193..67809b3c22ae 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_device_security_groups_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_device_security_groups_operations.py @@ -21,15 +21,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -204,7 +202,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -220,7 +217,6 @@ def prepare_request(next_link=None): _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 @@ -283,7 +279,6 @@ def get(self, resource_id: str, device_security_group_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -297,7 +292,7 @@ def get(self, resource_id: str, device_security_group_name: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DeviceSecurityGroup", pipeline_response) + deserialized = self._deserialize("DeviceSecurityGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -417,7 +412,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -431,11 +425,7 @@ def create_or_update( 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("DeviceSecurityGroup", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("DeviceSecurityGroup", pipeline_response) + deserialized = self._deserialize("DeviceSecurityGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -478,7 +468,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solution_analytics_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solution_analytics_operations.py index c14ac3bb70d4..33a13e9633eb 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solution_analytics_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solution_analytics_operations.py @@ -18,15 +18,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -164,7 +162,6 @@ def list( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -178,7 +175,7 @@ def list( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("IoTSecuritySolutionAnalyticsModelList", pipeline_response) + deserialized = self._deserialize("IoTSecuritySolutionAnalyticsModelList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -222,7 +219,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -236,7 +232,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("IoTSecuritySolutionAnalyticsModel", pipeline_response) + deserialized = self._deserialize("IoTSecuritySolutionAnalyticsModel", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solution_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solution_operations.py index d972d5e0e459..ddaa818b0188 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solution_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solution_operations.py @@ -21,15 +21,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -313,7 +311,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -329,7 +326,6 @@ def prepare_request(next_link=None): _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 @@ -401,7 +397,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -417,7 +412,6 @@ def prepare_request(next_link=None): _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 @@ -481,7 +475,6 @@ def get(self, resource_group_name: str, solution_name: str, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -495,7 +488,7 @@ def get(self, resource_group_name: str, solution_name: str, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("IoTSecuritySolutionModel", pipeline_response) + deserialized = self._deserialize("IoTSecuritySolutionModel", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -614,7 +607,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -628,11 +620,7 @@ def create_or_update( 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("IoTSecuritySolutionModel", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("IoTSecuritySolutionModel", pipeline_response) + deserialized = self._deserialize("IoTSecuritySolutionModel", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -754,7 +742,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -768,7 +755,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("IoTSecuritySolutionModel", pipeline_response) + deserialized = self._deserialize("IoTSecuritySolutionModel", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -812,7 +799,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solutions_analytics_aggregated_alert_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solutions_analytics_aggregated_alert_operations.py index e93a41081526..0099952f1971 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solutions_analytics_aggregated_alert_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solutions_analytics_aggregated_alert_operations.py @@ -20,15 +20,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -215,7 +213,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -231,7 +228,6 @@ def prepare_request(next_link=None): _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 @@ -301,7 +297,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -315,7 +310,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("IoTSecurityAggregatedAlert", pipeline_response) + deserialized = self._deserialize("IoTSecurityAggregatedAlert", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -362,7 +357,6 @@ def dismiss( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solutions_analytics_recommendation_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solutions_analytics_recommendation_operations.py index d903da5ccbbd..046d474b2594 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solutions_analytics_recommendation_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2019_08_01/operations/_iot_security_solutions_analytics_recommendation_operations.py @@ -20,15 +20,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -182,7 +180,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -196,7 +193,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("IoTSecurityAggregatedRecommendation", pipeline_response) + deserialized = self._deserialize("IoTSecurityAggregatedRecommendation", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -249,7 +246,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -265,7 +261,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_metadata.json index bea94ec13e71..f735ba4b15c0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -105,9 +105,7 @@ "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { - "adaptive_network_hardenings": "AdaptiveNetworkHardeningsOperations", "allowed_connections": "AllowedConnectionsOperations", - "adaptive_application_controls": "AdaptiveApplicationControlsOperations", "assessments_metadata": "AssessmentsMetadataOperations", "assessments": "AssessmentsOperations", "discovered_security_solutions": "DiscoveredSecuritySolutionsOperations", diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_security_center.py index dd669a12dafc..c3bf9ea49207 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -18,8 +19,6 @@ from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ( - AdaptiveApplicationControlsOperations, - AdaptiveNetworkHardeningsOperations, AllowedConnectionsOperations, AssessmentsMetadataOperations, AssessmentsOperations, @@ -43,15 +42,9 @@ class SecurityCenter: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """API spec for Microsoft.Security (Azure Security Center) resource provider. - :ivar adaptive_network_hardenings: AdaptiveNetworkHardeningsOperations operations - :vartype adaptive_network_hardenings: - azure.mgmt.security.v2020_01_01.operations.AdaptiveNetworkHardeningsOperations :ivar allowed_connections: AllowedConnectionsOperations operations :vartype allowed_connections: azure.mgmt.security.v2020_01_01.operations.AllowedConnectionsOperations - :ivar adaptive_application_controls: AdaptiveApplicationControlsOperations operations - :vartype adaptive_application_controls: - azure.mgmt.security.v2020_01_01.operations.AdaptiveApplicationControlsOperations :ivar assessments_metadata: AssessmentsMetadataOperations operations :vartype assessments_metadata: azure.mgmt.security.v2020_01_01.operations.AssessmentsMetadataOperations @@ -130,15 +123,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.adaptive_network_hardenings = AdaptiveNetworkHardeningsOperations( - self._client, self._config, self._serialize, self._deserialize, "2020-01-01" - ) self.allowed_connections = AllowedConnectionsOperations( self._client, self._config, self._serialize, self._deserialize, "2020-01-01" ) - self.adaptive_application_controls = AdaptiveApplicationControlsOperations( - self._client, self._config, self._serialize, self._deserialize, "2020-01-01" - ) self.assessments_metadata = AssessmentsMetadataOperations( self._client, self._config, self._serialize, self._deserialize, "2020-01-01" ) @@ -199,7 +186,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SecurityCenter": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_vendor.py +++ /dev/null @@ -1,16 +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 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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/_security_center.py index 9fe84135e96c..f72e4d63bf0f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -18,8 +19,6 @@ from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration from .operations import ( - AdaptiveApplicationControlsOperations, - AdaptiveNetworkHardeningsOperations, AllowedConnectionsOperations, AssessmentsMetadataOperations, AssessmentsOperations, @@ -43,15 +42,9 @@ class SecurityCenter: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """API spec for Microsoft.Security (Azure Security Center) resource provider. - :ivar adaptive_network_hardenings: AdaptiveNetworkHardeningsOperations operations - :vartype adaptive_network_hardenings: - azure.mgmt.security.v2020_01_01.aio.operations.AdaptiveNetworkHardeningsOperations :ivar allowed_connections: AllowedConnectionsOperations operations :vartype allowed_connections: azure.mgmt.security.v2020_01_01.aio.operations.AllowedConnectionsOperations - :ivar adaptive_application_controls: AdaptiveApplicationControlsOperations operations - :vartype adaptive_application_controls: - azure.mgmt.security.v2020_01_01.aio.operations.AdaptiveApplicationControlsOperations :ivar assessments_metadata: AssessmentsMetadataOperations operations :vartype assessments_metadata: azure.mgmt.security.v2020_01_01.aio.operations.AssessmentsMetadataOperations @@ -130,15 +123,9 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.adaptive_network_hardenings = AdaptiveNetworkHardeningsOperations( - self._client, self._config, self._serialize, self._deserialize, "2020-01-01" - ) self.allowed_connections = AllowedConnectionsOperations( self._client, self._config, self._serialize, self._deserialize, "2020-01-01" ) - self.adaptive_application_controls = AdaptiveApplicationControlsOperations( - self._client, self._config, self._serialize, self._deserialize, "2020-01-01" - ) self.assessments_metadata = AssessmentsMetadataOperations( self._client, self._config, self._serialize, self._deserialize, "2020-01-01" ) @@ -201,7 +188,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SecurityCenter": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/__init__.py index a3d32683f78c..135428241701 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/__init__.py @@ -6,9 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._adaptive_network_hardenings_operations import AdaptiveNetworkHardeningsOperations from ._allowed_connections_operations import AllowedConnectionsOperations -from ._adaptive_application_controls_operations import AdaptiveApplicationControlsOperations from ._assessments_metadata_operations import AssessmentsMetadataOperations from ._assessments_operations import AssessmentsOperations from ._discovered_security_solutions_operations import DiscoveredSecuritySolutionsOperations @@ -27,9 +25,7 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "AdaptiveNetworkHardeningsOperations", "AllowedConnectionsOperations", - "AdaptiveApplicationControlsOperations", "AssessmentsMetadataOperations", "AssessmentsOperations", "DiscoveredSecuritySolutionsOperations", diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_adaptive_application_controls_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_adaptive_application_controls_operations.py deleted file mode 100644 index f5110571025a..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_adaptive_application_controls_operations.py +++ /dev/null @@ -1,361 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload - -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_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._adaptive_application_controls_operations import ( - build_delete_request, - build_get_request, - build_list_request, - build_put_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AdaptiveApplicationControlsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.security.v2020_01_01.aio.SecurityCenter`'s - :attr:`adaptive_application_controls` 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") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace_async - async def list( - self, include_path_recommendations: Optional[bool] = None, summary: Optional[bool] = None, **kwargs: Any - ) -> _models.AdaptiveApplicationControlGroups: - """Gets a list of application control machine groups for the subscription. - - :param include_path_recommendations: Include the policy rules. Default value is None. - :type include_path_recommendations: bool - :param summary: Return output in a summarized form. Default value is None. - :type summary: bool - :return: AdaptiveApplicationControlGroups or the result of cls(response) - :rtype: ~azure.mgmt.security.v2020_01_01.models.AdaptiveApplicationControlGroups - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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", self._api_version or "2020-01-01")) - cls: ClsType[_models.AdaptiveApplicationControlGroups] = kwargs.pop("cls", None) - - _request = build_list_request( - subscription_id=self._config.subscription_id, - include_path_recommendations=include_path_recommendations, - summary=summary, - api_version=api_version, - 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("AdaptiveApplicationControlGroups", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get(self, asc_location: str, group_name: str, **kwargs: Any) -> _models.AdaptiveApplicationControlGroup: - """Gets an application control VM/server group. - - :param asc_location: The location where ASC stores the data of the subscription. can be - retrieved from Get locations. Required. - :type asc_location: str - :param group_name: Name of an application control machine group. Required. - :type group_name: str - :return: AdaptiveApplicationControlGroup or the result of cls(response) - :rtype: ~azure.mgmt.security.v2020_01_01.models.AdaptiveApplicationControlGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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", self._api_version or "2020-01-01")) - cls: ClsType[_models.AdaptiveApplicationControlGroup] = kwargs.pop("cls", None) - - _request = build_get_request( - asc_location=asc_location, - group_name=group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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("AdaptiveApplicationControlGroup", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def put( - self, - asc_location: str, - group_name: str, - body: _models.AdaptiveApplicationControlGroup, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AdaptiveApplicationControlGroup: - """Update an application control machine group. - - :param asc_location: The location where ASC stores the data of the subscription. can be - retrieved from Get locations. Required. - :type asc_location: str - :param group_name: Name of an application control machine group. Required. - :type group_name: str - :param body: Required. - :type body: ~azure.mgmt.security.v2020_01_01.models.AdaptiveApplicationControlGroup - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: AdaptiveApplicationControlGroup or the result of cls(response) - :rtype: ~azure.mgmt.security.v2020_01_01.models.AdaptiveApplicationControlGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def put( - self, - asc_location: str, - group_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AdaptiveApplicationControlGroup: - """Update an application control machine group. - - :param asc_location: The location where ASC stores the data of the subscription. can be - retrieved from Get locations. Required. - :type asc_location: str - :param group_name: Name of an application control machine group. Required. - :type group_name: str - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: AdaptiveApplicationControlGroup or the result of cls(response) - :rtype: ~azure.mgmt.security.v2020_01_01.models.AdaptiveApplicationControlGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def put( - self, - asc_location: str, - group_name: str, - body: Union[_models.AdaptiveApplicationControlGroup, IO[bytes]], - **kwargs: Any - ) -> _models.AdaptiveApplicationControlGroup: - """Update an application control machine group. - - :param asc_location: The location where ASC stores the data of the subscription. can be - retrieved from Get locations. Required. - :type asc_location: str - :param group_name: Name of an application control machine group. Required. - :type group_name: str - :param body: Is either a AdaptiveApplicationControlGroup type or a IO[bytes] type. Required. - :type body: ~azure.mgmt.security.v2020_01_01.models.AdaptiveApplicationControlGroup or - IO[bytes] - :return: AdaptiveApplicationControlGroup or the result of cls(response) - :rtype: ~azure.mgmt.security.v2020_01_01.models.AdaptiveApplicationControlGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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", self._api_version or "2020-01-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AdaptiveApplicationControlGroup] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _json = self._serialize.body(body, "AdaptiveApplicationControlGroup") - - _request = build_put_request( - asc_location=asc_location, - group_name=group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - 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("AdaptiveApplicationControlGroup", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, asc_location: str, group_name: str, **kwargs: Any - ) -> None: - """Delete an application control machine group. - - :param asc_location: The location where ASC stores the data of the subscription. can be - retrieved from Get locations. Required. - :type asc_location: str - :param group_name: Name of an application control machine group. Required. - :type group_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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", self._api_version or "2020-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - asc_location=asc_location, - group_name=group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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, 202, 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, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_adaptive_network_hardenings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_adaptive_network_hardenings_operations.py deleted file mode 100644 index 5ec9c8ffa455..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_adaptive_network_hardenings_operations.py +++ /dev/null @@ -1,458 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, cast, 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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._adaptive_network_hardenings_operations import ( - build_enforce_request, - build_get_request, - build_list_by_extended_resource_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AdaptiveNetworkHardeningsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.security.v2020_01_01.aio.SecurityCenter`'s - :attr:`adaptive_network_hardenings` 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") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_extended_resource( - self, resource_group_name: str, resource_namespace: str, resource_type: str, resource_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AdaptiveNetworkHardening"]: - """Gets a list of Adaptive Network Hardenings resources in scope of an extended resource. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param resource_namespace: The Namespace of the resource. Required. - :type resource_namespace: str - :param resource_type: The type of the resource. Required. - :type resource_type: str - :param resource_name: Name of the resource. Required. - :type resource_name: str - :return: An iterator like instance of either AdaptiveNetworkHardening or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.security.v2020_01_01.models.AdaptiveNetworkHardening] - :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", self._api_version or "2020-01-01")) - cls: ClsType[_models.AdaptiveNetworkHardeningsList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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_by_extended_resource_request( - resource_group_name=resource_group_name, - resource_namespace=resource_namespace, - resource_type=resource_type, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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._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("AdaptiveNetworkHardeningsList", 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) - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - resource_namespace: str, - resource_type: str, - resource_name: str, - adaptive_network_hardening_resource_name: str, - **kwargs: Any - ) -> _models.AdaptiveNetworkHardening: - """Gets a single Adaptive Network Hardening resource. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param resource_namespace: The Namespace of the resource. Required. - :type resource_namespace: str - :param resource_type: The type of the resource. Required. - :type resource_type: str - :param resource_name: Name of the resource. Required. - :type resource_name: str - :param adaptive_network_hardening_resource_name: The name of the Adaptive Network Hardening - resource. Required. - :type adaptive_network_hardening_resource_name: str - :return: AdaptiveNetworkHardening or the result of cls(response) - :rtype: ~azure.mgmt.security.v2020_01_01.models.AdaptiveNetworkHardening - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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", self._api_version or "2020-01-01")) - cls: ClsType[_models.AdaptiveNetworkHardening] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_namespace=resource_namespace, - resource_type=resource_type, - resource_name=resource_name, - adaptive_network_hardening_resource_name=adaptive_network_hardening_resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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("AdaptiveNetworkHardening", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _enforce_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_namespace: str, - resource_type: str, - resource_name: str, - adaptive_network_hardening_resource_name: str, - body: Union[_models.AdaptiveNetworkHardeningEnforceRequest, IO[bytes]], - **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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 {}) - - adaptive_network_hardening_enforce_action: Literal["enforce"] = kwargs.pop( - "adaptive_network_hardening_enforce_action", "enforce" - ) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _json = self._serialize.body(body, "AdaptiveNetworkHardeningEnforceRequest") - - _request = build_enforce_request( - resource_group_name=resource_group_name, - resource_namespace=resource_namespace, - resource_type=resource_type, - resource_name=resource_name, - adaptive_network_hardening_resource_name=adaptive_network_hardening_resource_name, - subscription_id=self._config.subscription_id, - adaptive_network_hardening_enforce_action=adaptive_network_hardening_enforce_action, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - 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, 202]: - 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, {}) # type: ignore - - @overload - async def begin_enforce( - self, - resource_group_name: str, - resource_namespace: str, - resource_type: str, - resource_name: str, - adaptive_network_hardening_resource_name: str, - body: _models.AdaptiveNetworkHardeningEnforceRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Enforces the given rules on the NSG(s) listed in the request. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param resource_namespace: The Namespace of the resource. Required. - :type resource_namespace: str - :param resource_type: The type of the resource. Required. - :type resource_type: str - :param resource_name: Name of the resource. Required. - :type resource_name: str - :param adaptive_network_hardening_resource_name: The name of the Adaptive Network Hardening - resource. Required. - :type adaptive_network_hardening_resource_name: str - :param body: Required. - :type body: ~azure.mgmt.security.v2020_01_01.models.AdaptiveNetworkHardeningEnforceRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_enforce( - self, - resource_group_name: str, - resource_namespace: str, - resource_type: str, - resource_name: str, - adaptive_network_hardening_resource_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Enforces the given rules on the NSG(s) listed in the request. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param resource_namespace: The Namespace of the resource. Required. - :type resource_namespace: str - :param resource_type: The type of the resource. Required. - :type resource_type: str - :param resource_name: Name of the resource. Required. - :type resource_name: str - :param adaptive_network_hardening_resource_name: The name of the Adaptive Network Hardening - resource. Required. - :type adaptive_network_hardening_resource_name: str - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_enforce( - self, - resource_group_name: str, - resource_namespace: str, - resource_type: str, - resource_name: str, - adaptive_network_hardening_resource_name: str, - body: Union[_models.AdaptiveNetworkHardeningEnforceRequest, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Enforces the given rules on the NSG(s) listed in the request. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param resource_namespace: The Namespace of the resource. Required. - :type resource_namespace: str - :param resource_type: The type of the resource. Required. - :type resource_type: str - :param resource_name: Name of the resource. Required. - :type resource_name: str - :param adaptive_network_hardening_resource_name: The name of the Adaptive Network Hardening - resource. Required. - :type adaptive_network_hardening_resource_name: str - :param body: Is either a AdaptiveNetworkHardeningEnforceRequest type or a IO[bytes] type. - Required. - :type body: ~azure.mgmt.security.v2020_01_01.models.AdaptiveNetworkHardeningEnforceRequest or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - adaptive_network_hardening_enforce_action: Literal["enforce"] = kwargs.pop( - "adaptive_network_hardening_enforce_action", "enforce" - ) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._enforce_initial( # type: ignore - resource_group_name=resource_group_name, - resource_namespace=resource_namespace, - resource_type=resource_type, - resource_name=resource_name, - adaptive_network_hardening_resource_name=adaptive_network_hardening_resource_name, - body=body, - adaptive_network_hardening_enforce_action=adaptive_network_hardening_enforce_action, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_allowed_connections_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_allowed_connections_operations.py index b0f2377b1028..8d2a97d09408 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_allowed_connections_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_allowed_connections_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._allowed_connections_operations import ( build_get_request, build_list_by_home_region_request, @@ -96,7 +94,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -112,7 +109,6 @@ def prepare_request(next_link=None): _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 @@ -180,7 +176,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -196,7 +191,6 @@ def prepare_request(next_link=None): _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 @@ -272,7 +266,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -286,7 +279,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AllowedConnectionsResource", pipeline_response) + deserialized = self._deserialize("AllowedConnectionsResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_assessments_metadata_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_assessments_metadata_operations.py index 9e29f8555bae..729133bf317a 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_assessments_metadata_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_assessments_metadata_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._assessments_metadata_operations import ( build_create_in_subscription_request, build_delete_in_subscription_request, @@ -99,7 +97,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -115,7 +112,6 @@ def prepare_request(next_link=None): _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 @@ -175,7 +171,6 @@ async def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.Sec headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -189,7 +184,7 @@ async def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.Sec map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityAssessmentMetadata", pipeline_response) + deserialized = self._deserialize("SecurityAssessmentMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -229,7 +224,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -245,7 +239,6 @@ def prepare_request(next_link=None): _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 @@ -308,7 +301,6 @@ async def get_in_subscription( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -322,7 +314,7 @@ async def get_in_subscription( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityAssessmentMetadata", pipeline_response) + deserialized = self._deserialize("SecurityAssessmentMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -430,7 +422,6 @@ async def create_in_subscription( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -444,7 +435,7 @@ async def create_in_subscription( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityAssessmentMetadata", pipeline_response) + deserialized = self._deserialize("SecurityAssessmentMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -486,7 +477,6 @@ async def delete_in_subscription( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_assessments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_assessments_operations.py index c304e0648eee..5b8289076799 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_assessments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_assessments_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._assessments_operations import ( build_create_or_update_request, build_delete_request, @@ -101,7 +99,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -117,7 +114,6 @@ def prepare_request(next_link=None): _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 @@ -189,7 +185,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -203,7 +198,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityAssessment", pipeline_response) + deserialized = self._deserialize("SecurityAssessment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -319,7 +314,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -333,11 +327,7 @@ async def create_or_update( 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("SecurityAssessment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SecurityAssessment", pipeline_response) + deserialized = self._deserialize("SecurityAssessment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -380,7 +370,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_discovered_security_solutions_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_discovered_security_solutions_operations.py index e5dcae4f12e7..da4ee21e22da 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_discovered_security_solutions_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_discovered_security_solutions_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._discovered_security_solutions_operations import ( build_get_request, build_list_by_home_region_request, @@ -96,7 +94,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -112,7 +109,6 @@ def prepare_request(next_link=None): _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 @@ -180,7 +176,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -196,7 +191,6 @@ def prepare_request(next_link=None): _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 @@ -266,7 +260,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -280,7 +273,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiscoveredSecuritySolution", pipeline_response) + deserialized = self._deserialize("DiscoveredSecuritySolution", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_external_security_solutions_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_external_security_solutions_operations.py index a794d5290533..89e12e6511af 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_external_security_solutions_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_external_security_solutions_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._external_security_solutions_operations import ( build_get_request, build_list_by_home_region_request, @@ -96,7 +94,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -112,7 +109,6 @@ def prepare_request(next_link=None): _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 @@ -180,7 +176,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -196,7 +191,6 @@ def prepare_request(next_link=None): _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 @@ -266,7 +260,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -280,7 +273,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ExternalSecuritySolution", pipeline_response) + deserialized = self._deserialize("ExternalSecuritySolution", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_jit_network_access_policies_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_jit_network_access_policies_operations.py index ac85dbc09c69..2cfdffd4d8e0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_jit_network_access_policies_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_jit_network_access_policies_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._jit_network_access_policies_operations import ( build_create_or_update_request, build_delete_request, @@ -102,7 +100,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -118,7 +115,6 @@ def prepare_request(next_link=None): _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 @@ -185,7 +181,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -201,7 +196,6 @@ def prepare_request(next_link=None): _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 @@ -270,7 +264,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -286,7 +279,6 @@ def prepare_request(next_link=None): _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 @@ -359,7 +351,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -375,7 +366,6 @@ def prepare_request(next_link=None): _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 @@ -447,7 +437,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -461,7 +450,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("JitNetworkAccessPolicy", pipeline_response) + deserialized = self._deserialize("JitNetworkAccessPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -593,7 +582,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -607,7 +595,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("JitNetworkAccessPolicy", pipeline_response) + deserialized = self._deserialize("JitNetworkAccessPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -656,7 +644,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -804,7 +791,6 @@ async def initiate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -818,7 +804,7 @@ async def initiate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("JitNetworkAccessRequest", pipeline_response) + deserialized = self._deserialize("JitNetworkAccessRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_score_control_definitions_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_score_control_definitions_operations.py index ecb3a4365fff..d14083a8a574 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_score_control_definitions_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_score_control_definitions_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 from ...operations._secure_score_control_definitions_operations import ( build_list_by_subscription_request, build_list_request, @@ -93,7 +91,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -109,7 +106,6 @@ def prepare_request(next_link=None): _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 @@ -172,7 +168,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -188,7 +183,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_score_controls_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_score_controls_operations.py index 901d43d353e9..7a8af8c6398b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_score_controls_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_score_controls_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 from ...operations._secure_score_controls_operations import build_list_by_secure_score_request, build_list_request if sys.version_info >= (3, 9): @@ -100,7 +98,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -116,7 +113,6 @@ def prepare_request(next_link=None): _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 @@ -183,7 +179,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -199,7 +194,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_scores_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_scores_operations.py index ef0f7aa9c823..53e0d99b7f2e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_scores_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_secure_scores_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._secure_scores_operations import build_get_request, build_list_request if sys.version_info >= (3, 9): @@ -92,7 +90,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -108,7 +105,6 @@ def prepare_request(next_link=None): _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 @@ -170,7 +166,6 @@ async def get(self, secure_score_name: str, **kwargs: Any) -> _models.SecureScor headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -184,7 +179,7 @@ async def get(self, secure_score_name: str, **kwargs: Any) -> _models.SecureScor map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecureScoreItem", pipeline_response) + deserialized = self._deserialize("SecureScoreItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_security_solutions_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_security_solutions_operations.py index 90e08c27f3b9..a3e3b964d374 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_security_solutions_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_security_solutions_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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_solutions_operations import build_get_request, build_list_request if sys.version_info >= (3, 9): @@ -91,7 +89,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -107,7 +104,6 @@ def prepare_request(next_link=None): _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 @@ -177,7 +173,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -191,7 +186,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecuritySolution", pipeline_response) + deserialized = self._deserialize("SecuritySolution", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_security_solutions_reference_data_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_security_solutions_reference_data_operations.py index 03f2696b828d..a575b6b7c264 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_security_solutions_reference_data_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_security_solutions_reference_data_operations.py @@ -18,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 -from ..._vendor import _convert_request from ...operations._security_solutions_reference_data_operations import ( build_list_by_home_region_request, build_list_request, @@ -87,7 +85,6 @@ async def list(self, **kwargs: Any) -> _models.SecuritySolutionsReferenceDataLis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -101,7 +98,7 @@ async def list(self, **kwargs: Any) -> _models.SecuritySolutionsReferenceDataLis map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecuritySolutionsReferenceDataList", pipeline_response) + deserialized = self._deserialize("SecuritySolutionsReferenceDataList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -140,7 +137,6 @@ async def list_by_home_region(self, asc_location: str, **kwargs: Any) -> _models headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -154,7 +150,7 @@ async def list_by_home_region(self, asc_location: str, **kwargs: Any) -> _models map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecuritySolutionsReferenceDataList", pipeline_response) + deserialized = self._deserialize("SecuritySolutionsReferenceDataList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_server_vulnerability_assessment_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_server_vulnerability_assessment_operations.py index 1b2a2e982324..f584bb199265 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_server_vulnerability_assessment_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_server_vulnerability_assessment_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar, Union, cast +from typing import Any, AsyncIterator, Callable, Dict, Literal, Optional, Type, TypeVar, Union, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,19 +15,19 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._server_vulnerability_assessment_operations import ( build_create_or_update_request, build_delete_request, @@ -106,7 +106,6 @@ async def list_by_extended_resource( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -120,7 +119,7 @@ async def list_by_extended_resource( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServerVulnerabilityAssessmentsList", pipeline_response) + deserialized = self._deserialize("ServerVulnerabilityAssessmentsList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -172,7 +171,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -186,7 +184,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServerVulnerabilityAssessment", pipeline_response) + deserialized = self._deserialize("ServerVulnerabilityAssessment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -239,7 +237,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -253,16 +250,16 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServerVulnerabilityAssessment", pipeline_response) + deserialized = self._deserialize("ServerVulnerabilityAssessment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, resource_namespace: str, resource_type: str, resource_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -276,7 +273,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements server_vulnerability_assessment: Literal["default"] = kwargs.pop("server_vulnerability_assessment", "default") api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -289,10 +286,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -300,11 +297,19 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -335,7 +340,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, resource_namespace=resource_namespace, resource_type=resource_type, @@ -347,6 +352,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_topology_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_topology_operations.py index 96e3416f744b..b9b5a8d013cc 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_topology_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/aio/operations/_topology_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._topology_operations import build_get_request, build_list_by_home_region_request, build_list_request if sys.version_info >= (3, 9): @@ -91,7 +89,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -107,7 +104,6 @@ def prepare_request(next_link=None): _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 @@ -172,7 +168,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -188,7 +183,6 @@ def prepare_request(next_link=None): _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 @@ -258,7 +252,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -272,7 +265,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TopologyResource", pipeline_response) + deserialized = self._deserialize("TopologyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/__init__.py index 696464205ce0..a95cc0a921f7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/__init__.py @@ -9,12 +9,6 @@ from ._models_py3 import AadConnectivityState from ._models_py3 import AadExternalSecuritySolution from ._models_py3 import AadSolutionProperties -from ._models_py3 import AdaptiveApplicationControlGroup -from ._models_py3 import AdaptiveApplicationControlGroups -from ._models_py3 import AdaptiveApplicationControlIssueSummary -from ._models_py3 import AdaptiveNetworkHardening -from ._models_py3 import AdaptiveNetworkHardeningEnforceRequest -from ._models_py3 import AdaptiveNetworkHardeningsList from ._models_py3 import AllowedConnectionsList from ._models_py3 import AllowedConnectionsResource from ._models_py3 import AssessmentLinks @@ -31,7 +25,6 @@ from ._models_py3 import ConnectedWorkspace from ._models_py3 import DiscoveredSecuritySolution from ._models_py3 import DiscoveredSecuritySolutionList -from ._models_py3 import EffectiveNetworkSecurityGroups from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ExternalSecuritySolution from ._models_py3 import ExternalSecuritySolutionKind @@ -51,12 +44,8 @@ from ._models_py3 import Location from ._models_py3 import OnPremiseResourceDetails from ._models_py3 import OnPremiseSqlResourceDetails -from ._models_py3 import PathRecommendation -from ._models_py3 import ProtectionMode -from ._models_py3 import PublisherInfo from ._models_py3 import Resource from ._models_py3 import ResourceDetails -from ._models_py3 import Rule from ._models_py3 import SecureScoreControlDefinitionItem from ._models_py3 import SecureScoreControlDefinitionList from ._models_py3 import SecureScoreControlDefinitionSource @@ -83,39 +72,26 @@ from ._models_py3 import TopologySingleResource from ._models_py3 import TopologySingleResourceChild from ._models_py3 import TopologySingleResourceParent -from ._models_py3 import UserRecommendation -from ._models_py3 import VmRecommendation from ._security_center_enums import AadConnectivityStateEnum -from ._security_center_enums import AdaptiveApplicationControlIssue from ._security_center_enums import AssessmentStatusCode from ._security_center_enums import AssessmentType from ._security_center_enums import Categories -from ._security_center_enums import ConfigurationStatus from ._security_center_enums import ConnectionType from ._security_center_enums import ControlType -from ._security_center_enums import Direction -from ._security_center_enums import EnforcementMode -from ._security_center_enums import EnforcementSupport from ._security_center_enums import ExpandControlsEnum from ._security_center_enums import ExpandEnum from ._security_center_enums import ExternalSecuritySolutionKindEnum -from ._security_center_enums import FileType from ._security_center_enums import ImplementationEffort from ._security_center_enums import ProtocolEnum from ._security_center_enums import ProvisioningState -from ._security_center_enums import RecommendationAction -from ._security_center_enums import RecommendationStatus -from ._security_center_enums import RecommendationType from ._security_center_enums import SecurityFamily from ._security_center_enums import ServerVulnerabilityAssessmentPropertiesProvisioningState from ._security_center_enums import Severity from ._security_center_enums import Source -from ._security_center_enums import SourceSystem from ._security_center_enums import Status from ._security_center_enums import StatusReason from ._security_center_enums import Threats -from ._security_center_enums import TransportProtocol from ._security_center_enums import UserImpact from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -125,12 +101,6 @@ "AadConnectivityState", "AadExternalSecuritySolution", "AadSolutionProperties", - "AdaptiveApplicationControlGroup", - "AdaptiveApplicationControlGroups", - "AdaptiveApplicationControlIssueSummary", - "AdaptiveNetworkHardening", - "AdaptiveNetworkHardeningEnforceRequest", - "AdaptiveNetworkHardeningsList", "AllowedConnectionsList", "AllowedConnectionsResource", "AssessmentLinks", @@ -147,7 +117,6 @@ "ConnectedWorkspace", "DiscoveredSecuritySolution", "DiscoveredSecuritySolutionList", - "EffectiveNetworkSecurityGroups", "ErrorAdditionalInfo", "ExternalSecuritySolution", "ExternalSecuritySolutionKind", @@ -167,12 +136,8 @@ "Location", "OnPremiseResourceDetails", "OnPremiseSqlResourceDetails", - "PathRecommendation", - "ProtectionMode", - "PublisherInfo", "Resource", "ResourceDetails", - "Rule", "SecureScoreControlDefinitionItem", "SecureScoreControlDefinitionList", "SecureScoreControlDefinitionSource", @@ -199,38 +164,25 @@ "TopologySingleResource", "TopologySingleResourceChild", "TopologySingleResourceParent", - "UserRecommendation", - "VmRecommendation", "AadConnectivityStateEnum", - "AdaptiveApplicationControlIssue", "AssessmentStatusCode", "AssessmentType", "Categories", - "ConfigurationStatus", "ConnectionType", "ControlType", - "Direction", - "EnforcementMode", - "EnforcementSupport", "ExpandControlsEnum", "ExpandEnum", "ExternalSecuritySolutionKindEnum", - "FileType", "ImplementationEffort", "ProtocolEnum", "ProvisioningState", - "RecommendationAction", - "RecommendationStatus", - "RecommendationType", "SecurityFamily", "ServerVulnerabilityAssessmentPropertiesProvisioningState", "Severity", "Source", - "SourceSystem", "Status", "StatusReason", "Threats", - "TransportProtocol", "UserImpact", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/_models_py3.py index fa0c2aba10dc..1a10a63576da 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/_models_py3.py @@ -338,301 +338,6 @@ def __init__( self.workspace = workspace -class AdaptiveApplicationControlGroup(Resource, Location): # pylint: disable=too-many-instance-attributes - """AdaptiveApplicationControlGroup. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar location: Location where the resource is stored. - :vartype location: str - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar enforcement_mode: The application control policy enforcement/protection mode of the - machine group. Known values are: "Audit", "Enforce", and "None". - :vartype enforcement_mode: str or ~azure.mgmt.security.v2020_01_01.models.EnforcementMode - :ivar protection_mode: The protection mode of the collection/file types. Exe/Msi/Script are - used for Windows, Executable is used for Linux. - :vartype protection_mode: ~azure.mgmt.security.v2020_01_01.models.ProtectionMode - :ivar configuration_status: The configuration status of the machines group or machine or rule. - Known values are: "Configured", "NotConfigured", "InProgress", "Failed", and "NoStatus". - :vartype configuration_status: str or - ~azure.mgmt.security.v2020_01_01.models.ConfigurationStatus - :ivar recommendation_status: The initial recommendation status of the machine group or machine. - Known values are: "Recommended", "NotRecommended", "NotAvailable", and "NoStatus". - :vartype recommendation_status: str or - ~azure.mgmt.security.v2020_01_01.models.RecommendationStatus - :ivar issues: - :vartype issues: - list[~azure.mgmt.security.v2020_01_01.models.AdaptiveApplicationControlIssueSummary] - :ivar source_system: The source type of the machine group. Known values are: "Azure_AppLocker", - "Azure_AuditD", "NonAzure_AppLocker", "NonAzure_AuditD", and "None". - :vartype source_system: str or ~azure.mgmt.security.v2020_01_01.models.SourceSystem - :ivar vm_recommendations: - :vartype vm_recommendations: list[~azure.mgmt.security.v2020_01_01.models.VmRecommendation] - :ivar path_recommendations: - :vartype path_recommendations: list[~azure.mgmt.security.v2020_01_01.models.PathRecommendation] - """ - - _validation = { - "location": {"readonly": True}, - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "configuration_status": {"readonly": True}, - "recommendation_status": {"readonly": True}, - "issues": {"readonly": True}, - "source_system": {"readonly": True}, - } - - _attribute_map = { - "location": {"key": "location", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "enforcement_mode": {"key": "properties.enforcementMode", "type": "str"}, - "protection_mode": {"key": "properties.protectionMode", "type": "ProtectionMode"}, - "configuration_status": {"key": "properties.configurationStatus", "type": "str"}, - "recommendation_status": {"key": "properties.recommendationStatus", "type": "str"}, - "issues": {"key": "properties.issues", "type": "[AdaptiveApplicationControlIssueSummary]"}, - "source_system": {"key": "properties.sourceSystem", "type": "str"}, - "vm_recommendations": {"key": "properties.vmRecommendations", "type": "[VmRecommendation]"}, - "path_recommendations": {"key": "properties.pathRecommendations", "type": "[PathRecommendation]"}, - } - - def __init__( - self, - *, - enforcement_mode: Optional[Union[str, "_models.EnforcementMode"]] = None, - protection_mode: Optional["_models.ProtectionMode"] = None, - vm_recommendations: Optional[List["_models.VmRecommendation"]] = None, - path_recommendations: Optional[List["_models.PathRecommendation"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword enforcement_mode: The application control policy enforcement/protection mode of the - machine group. Known values are: "Audit", "Enforce", and "None". - :paramtype enforcement_mode: str or ~azure.mgmt.security.v2020_01_01.models.EnforcementMode - :keyword protection_mode: The protection mode of the collection/file types. Exe/Msi/Script are - used for Windows, Executable is used for Linux. - :paramtype protection_mode: ~azure.mgmt.security.v2020_01_01.models.ProtectionMode - :keyword vm_recommendations: - :paramtype vm_recommendations: list[~azure.mgmt.security.v2020_01_01.models.VmRecommendation] - :keyword path_recommendations: - :paramtype path_recommendations: - list[~azure.mgmt.security.v2020_01_01.models.PathRecommendation] - """ - super().__init__(**kwargs) - self.location = None - self.enforcement_mode = enforcement_mode - self.protection_mode = protection_mode - self.configuration_status = None - self.recommendation_status = None - self.issues = None - self.source_system = None - self.vm_recommendations = vm_recommendations - self.path_recommendations = path_recommendations - self.id = None - self.name = None - self.type = None - - -class AdaptiveApplicationControlGroups(_serialization.Model): - """Represents a list of VM/server groups and set of rules that are Recommended by Microsoft - Defender for Cloud to be allowed. - - :ivar value: - :vartype value: list[~azure.mgmt.security.v2020_01_01.models.AdaptiveApplicationControlGroup] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[AdaptiveApplicationControlGroup]"}, - } - - def __init__( - self, *, value: Optional[List["_models.AdaptiveApplicationControlGroup"]] = None, **kwargs: Any - ) -> None: - """ - :keyword value: - :paramtype value: list[~azure.mgmt.security.v2020_01_01.models.AdaptiveApplicationControlGroup] - """ - super().__init__(**kwargs) - self.value = value - - -class AdaptiveApplicationControlIssueSummary(_serialization.Model): - """Represents a summary of the alerts of the machine group. - - :ivar issue: An alert that machines within a group can have. Known values are: - "ViolationsAudited", "ViolationsBlocked", "MsiAndScriptViolationsAudited", - "MsiAndScriptViolationsBlocked", "ExecutableViolationsAudited", and "RulesViolatedManually". - :vartype issue: str or ~azure.mgmt.security.v2020_01_01.models.AdaptiveApplicationControlIssue - :ivar number_of_vms: The number of machines in the group that have this alert. - :vartype number_of_vms: float - """ - - _attribute_map = { - "issue": {"key": "issue", "type": "str"}, - "number_of_vms": {"key": "numberOfVms", "type": "float"}, - } - - def __init__( - self, - *, - issue: Optional[Union[str, "_models.AdaptiveApplicationControlIssue"]] = None, - number_of_vms: Optional[float] = None, - **kwargs: Any - ) -> None: - """ - :keyword issue: An alert that machines within a group can have. Known values are: - "ViolationsAudited", "ViolationsBlocked", "MsiAndScriptViolationsAudited", - "MsiAndScriptViolationsBlocked", "ExecutableViolationsAudited", and "RulesViolatedManually". - :paramtype issue: str or - ~azure.mgmt.security.v2020_01_01.models.AdaptiveApplicationControlIssue - :keyword number_of_vms: The number of machines in the group that have this alert. - :paramtype number_of_vms: float - """ - super().__init__(**kwargs) - self.issue = issue - self.number_of_vms = number_of_vms - - -class AdaptiveNetworkHardening(Resource): - """The resource whose properties describes the Adaptive Network Hardening settings for some 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 - :ivar rules: The security rules which are recommended to be effective on the VM. - :vartype rules: list[~azure.mgmt.security.v2020_01_01.models.Rule] - :ivar rules_calculation_time: The UTC time on which the rules were calculated. - :vartype rules_calculation_time: ~datetime.datetime - :ivar effective_network_security_groups: The Network Security Groups effective on the network - interfaces of the protected resource. - :vartype effective_network_security_groups: - list[~azure.mgmt.security.v2020_01_01.models.EffectiveNetworkSecurityGroups] - """ - - _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"}, - "rules": {"key": "properties.rules", "type": "[Rule]"}, - "rules_calculation_time": {"key": "properties.rulesCalculationTime", "type": "iso-8601"}, - "effective_network_security_groups": { - "key": "properties.effectiveNetworkSecurityGroups", - "type": "[EffectiveNetworkSecurityGroups]", - }, - } - - def __init__( - self, - *, - rules: Optional[List["_models.Rule"]] = None, - rules_calculation_time: Optional[datetime.datetime] = None, - effective_network_security_groups: Optional[List["_models.EffectiveNetworkSecurityGroups"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword rules: The security rules which are recommended to be effective on the VM. - :paramtype rules: list[~azure.mgmt.security.v2020_01_01.models.Rule] - :keyword rules_calculation_time: The UTC time on which the rules were calculated. - :paramtype rules_calculation_time: ~datetime.datetime - :keyword effective_network_security_groups: The Network Security Groups effective on the - network interfaces of the protected resource. - :paramtype effective_network_security_groups: - list[~azure.mgmt.security.v2020_01_01.models.EffectiveNetworkSecurityGroups] - """ - super().__init__(**kwargs) - self.rules = rules - self.rules_calculation_time = rules_calculation_time - self.effective_network_security_groups = effective_network_security_groups - - -class AdaptiveNetworkHardeningEnforceRequest(_serialization.Model): - """AdaptiveNetworkHardeningEnforceRequest. - - All required parameters must be populated in order to send to server. - - :ivar rules: The rules to enforce. Required. - :vartype rules: list[~azure.mgmt.security.v2020_01_01.models.Rule] - :ivar network_security_groups: The Azure resource IDs of the effective network security groups - that will be updated with the created security rules from the Adaptive Network Hardening rules. - Required. - :vartype network_security_groups: list[str] - """ - - _validation = { - "rules": {"required": True}, - "network_security_groups": {"required": True}, - } - - _attribute_map = { - "rules": {"key": "rules", "type": "[Rule]"}, - "network_security_groups": {"key": "networkSecurityGroups", "type": "[str]"}, - } - - def __init__(self, *, rules: List["_models.Rule"], network_security_groups: List[str], **kwargs: Any) -> None: - """ - :keyword rules: The rules to enforce. Required. - :paramtype rules: list[~azure.mgmt.security.v2020_01_01.models.Rule] - :keyword network_security_groups: The Azure resource IDs of the effective network security - groups that will be updated with the created security rules from the Adaptive Network Hardening - rules. Required. - :paramtype network_security_groups: list[str] - """ - super().__init__(**kwargs) - self.rules = rules - self.network_security_groups = network_security_groups - - -class AdaptiveNetworkHardeningsList(_serialization.Model): - """Response for ListAdaptiveNetworkHardenings API service call. - - :ivar value: A list of Adaptive Network Hardenings resources. - :vartype value: list[~azure.mgmt.security.v2020_01_01.models.AdaptiveNetworkHardening] - :ivar next_link: The URL to get the next set of results. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[AdaptiveNetworkHardening]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.AdaptiveNetworkHardening"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: A list of Adaptive Network Hardenings resources. - :paramtype value: list[~azure.mgmt.security.v2020_01_01.models.AdaptiveNetworkHardening] - :keyword next_link: The URL to get the next set of results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - class AllowedConnectionsList(_serialization.Model): """List of all possible traffic between Azure resources. @@ -1340,39 +1045,6 @@ def __init__(self, *, value: Optional[List["_models.DiscoveredSecuritySolution"] self.next_link = None -class EffectiveNetworkSecurityGroups(_serialization.Model): - """Describes the Network Security Groups effective on a network interface. - - :ivar network_interface: The Azure resource ID of the network interface. - :vartype network_interface: str - :ivar network_security_groups: The Network Security Groups effective on the network interface. - :vartype network_security_groups: list[str] - """ - - _attribute_map = { - "network_interface": {"key": "networkInterface", "type": "str"}, - "network_security_groups": {"key": "networkSecurityGroups", "type": "[str]"}, - } - - def __init__( - self, - *, - network_interface: Optional[str] = None, - network_security_groups: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword network_interface: The Azure resource ID of the network interface. - :paramtype network_interface: str - :keyword network_security_groups: The Network Security Groups effective on the network - interface. - :paramtype network_security_groups: list[str] - """ - super().__init__(**kwargs) - self.network_interface = network_interface - self.network_security_groups = network_security_groups - - class ErrorAdditionalInfo(_serialization.Model): """The resource management error additional info. @@ -2121,261 +1793,6 @@ def __init__( self.database_name = database_name -class PathRecommendation(_serialization.Model): - """Represents a path that is recommended to be allowed and its properties. - - :ivar path: The full path of the file, or an identifier of the application. - :vartype path: str - :ivar action: The recommendation action of the machine or rule. Known values are: - "Recommended", "Add", and "Remove". - :vartype action: str or ~azure.mgmt.security.v2020_01_01.models.RecommendationAction - :ivar type: The type of the rule to be allowed. Known values are: "File", "FileHash", - "PublisherSignature", "ProductSignature", "BinarySignature", and "VersionAndAboveSignature". - :vartype type: str or ~azure.mgmt.security.v2020_01_01.models.RecommendationType - :ivar publisher_info: Represents the publisher information of a process/rule. - :vartype publisher_info: ~azure.mgmt.security.v2020_01_01.models.PublisherInfo - :ivar common: Whether the application is commonly run on the machine. - :vartype common: bool - :ivar user_sids: - :vartype user_sids: list[str] - :ivar usernames: - :vartype usernames: list[~azure.mgmt.security.v2020_01_01.models.UserRecommendation] - :ivar file_type: The type of the file (for Linux files - Executable is used). Known values are: - "Exe", "Dll", "Msi", "Script", "Executable", and "Unknown". - :vartype file_type: str or ~azure.mgmt.security.v2020_01_01.models.FileType - :ivar configuration_status: The configuration status of the machines group or machine or rule. - Known values are: "Configured", "NotConfigured", "InProgress", "Failed", and "NoStatus". - :vartype configuration_status: str or - ~azure.mgmt.security.v2020_01_01.models.ConfigurationStatus - """ - - _attribute_map = { - "path": {"key": "path", "type": "str"}, - "action": {"key": "action", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "publisher_info": {"key": "publisherInfo", "type": "PublisherInfo"}, - "common": {"key": "common", "type": "bool"}, - "user_sids": {"key": "userSids", "type": "[str]"}, - "usernames": {"key": "usernames", "type": "[UserRecommendation]"}, - "file_type": {"key": "fileType", "type": "str"}, - "configuration_status": {"key": "configurationStatus", "type": "str"}, - } - - def __init__( - self, - *, - path: Optional[str] = None, - action: Optional[Union[str, "_models.RecommendationAction"]] = None, - type: Optional[Union[str, "_models.RecommendationType"]] = None, - publisher_info: Optional["_models.PublisherInfo"] = None, - common: Optional[bool] = None, - user_sids: Optional[List[str]] = None, - usernames: Optional[List["_models.UserRecommendation"]] = None, - file_type: Optional[Union[str, "_models.FileType"]] = None, - configuration_status: Optional[Union[str, "_models.ConfigurationStatus"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword path: The full path of the file, or an identifier of the application. - :paramtype path: str - :keyword action: The recommendation action of the machine or rule. Known values are: - "Recommended", "Add", and "Remove". - :paramtype action: str or ~azure.mgmt.security.v2020_01_01.models.RecommendationAction - :keyword type: The type of the rule to be allowed. Known values are: "File", "FileHash", - "PublisherSignature", "ProductSignature", "BinarySignature", and "VersionAndAboveSignature". - :paramtype type: str or ~azure.mgmt.security.v2020_01_01.models.RecommendationType - :keyword publisher_info: Represents the publisher information of a process/rule. - :paramtype publisher_info: ~azure.mgmt.security.v2020_01_01.models.PublisherInfo - :keyword common: Whether the application is commonly run on the machine. - :paramtype common: bool - :keyword user_sids: - :paramtype user_sids: list[str] - :keyword usernames: - :paramtype usernames: list[~azure.mgmt.security.v2020_01_01.models.UserRecommendation] - :keyword file_type: The type of the file (for Linux files - Executable is used). Known values - are: "Exe", "Dll", "Msi", "Script", "Executable", and "Unknown". - :paramtype file_type: str or ~azure.mgmt.security.v2020_01_01.models.FileType - :keyword configuration_status: The configuration status of the machines group or machine or - rule. Known values are: "Configured", "NotConfigured", "InProgress", "Failed", and "NoStatus". - :paramtype configuration_status: str or - ~azure.mgmt.security.v2020_01_01.models.ConfigurationStatus - """ - super().__init__(**kwargs) - self.path = path - self.action = action - self.type = type - self.publisher_info = publisher_info - self.common = common - self.user_sids = user_sids - self.usernames = usernames - self.file_type = file_type - self.configuration_status = configuration_status - - -class ProtectionMode(_serialization.Model): - """The protection mode of the collection/file types. Exe/Msi/Script are used for Windows, - Executable is used for Linux. - - :ivar exe: The application control policy enforcement/protection mode of the machine group. - Known values are: "Audit", "Enforce", and "None". - :vartype exe: str or ~azure.mgmt.security.v2020_01_01.models.EnforcementMode - :ivar msi: The application control policy enforcement/protection mode of the machine group. - Known values are: "Audit", "Enforce", and "None". - :vartype msi: str or ~azure.mgmt.security.v2020_01_01.models.EnforcementMode - :ivar script: The application control policy enforcement/protection mode of the machine group. - Known values are: "Audit", "Enforce", and "None". - :vartype script: str or ~azure.mgmt.security.v2020_01_01.models.EnforcementMode - :ivar executable: The application control policy enforcement/protection mode of the machine - group. Known values are: "Audit", "Enforce", and "None". - :vartype executable: str or ~azure.mgmt.security.v2020_01_01.models.EnforcementMode - """ - - _attribute_map = { - "exe": {"key": "exe", "type": "str"}, - "msi": {"key": "msi", "type": "str"}, - "script": {"key": "script", "type": "str"}, - "executable": {"key": "executable", "type": "str"}, - } - - def __init__( - self, - *, - exe: Optional[Union[str, "_models.EnforcementMode"]] = None, - msi: Optional[Union[str, "_models.EnforcementMode"]] = None, - script: Optional[Union[str, "_models.EnforcementMode"]] = None, - executable: Optional[Union[str, "_models.EnforcementMode"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword exe: The application control policy enforcement/protection mode of the machine group. - Known values are: "Audit", "Enforce", and "None". - :paramtype exe: str or ~azure.mgmt.security.v2020_01_01.models.EnforcementMode - :keyword msi: The application control policy enforcement/protection mode of the machine group. - Known values are: "Audit", "Enforce", and "None". - :paramtype msi: str or ~azure.mgmt.security.v2020_01_01.models.EnforcementMode - :keyword script: The application control policy enforcement/protection mode of the machine - group. Known values are: "Audit", "Enforce", and "None". - :paramtype script: str or ~azure.mgmt.security.v2020_01_01.models.EnforcementMode - :keyword executable: The application control policy enforcement/protection mode of the machine - group. Known values are: "Audit", "Enforce", and "None". - :paramtype executable: str or ~azure.mgmt.security.v2020_01_01.models.EnforcementMode - """ - super().__init__(**kwargs) - self.exe = exe - self.msi = msi - self.script = script - self.executable = executable - - -class PublisherInfo(_serialization.Model): - """Represents the publisher information of a process/rule. - - :ivar publisher_name: The Subject field of the x.509 certificate used to sign the code, using - the following fields - O = Organization, L = Locality, S = State or Province, and C = Country. - :vartype publisher_name: str - :ivar product_name: The product name taken from the file's version resource. - :vartype product_name: str - :ivar binary_name: The "OriginalName" field taken from the file's version resource. - :vartype binary_name: str - :ivar version: The binary file version taken from the file's version resource. - :vartype version: str - """ - - _attribute_map = { - "publisher_name": {"key": "publisherName", "type": "str"}, - "product_name": {"key": "productName", "type": "str"}, - "binary_name": {"key": "binaryName", "type": "str"}, - "version": {"key": "version", "type": "str"}, - } - - def __init__( - self, - *, - publisher_name: Optional[str] = None, - product_name: Optional[str] = None, - binary_name: Optional[str] = None, - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword publisher_name: The Subject field of the x.509 certificate used to sign the code, - using the following fields - O = Organization, L = Locality, S = State or Province, and C = - Country. - :paramtype publisher_name: str - :keyword product_name: The product name taken from the file's version resource. - :paramtype product_name: str - :keyword binary_name: The "OriginalName" field taken from the file's version resource. - :paramtype binary_name: str - :keyword version: The binary file version taken from the file's version resource. - :paramtype version: str - """ - super().__init__(**kwargs) - self.publisher_name = publisher_name - self.product_name = product_name - self.binary_name = binary_name - self.version = version - - -class Rule(_serialization.Model): - """Describes remote addresses that is recommended to communicate with the Azure resource on some - (Protocol, Port, Direction). All other remote addresses are recommended to be blocked. - - :ivar name: The name of the rule. - :vartype name: str - :ivar direction: The rule's direction. Known values are: "Inbound" and "Outbound". - :vartype direction: str or ~azure.mgmt.security.v2020_01_01.models.Direction - :ivar destination_port: The rule's destination port. - :vartype destination_port: int - :ivar protocols: The rule's transport protocols. - :vartype protocols: list[str or ~azure.mgmt.security.v2020_01_01.models.TransportProtocol] - :ivar ip_addresses: The remote IP addresses that should be able to communicate with the Azure - resource on the rule's destination port and protocol. - :vartype ip_addresses: list[str] - """ - - _validation = { - "destination_port": {"maximum": 65535, "minimum": 0}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "direction": {"key": "direction", "type": "str"}, - "destination_port": {"key": "destinationPort", "type": "int"}, - "protocols": {"key": "protocols", "type": "[str]"}, - "ip_addresses": {"key": "ipAddresses", "type": "[str]"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - direction: Optional[Union[str, "_models.Direction"]] = None, - destination_port: Optional[int] = None, - protocols: Optional[List[Union[str, "_models.TransportProtocol"]]] = None, - ip_addresses: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of the rule. - :paramtype name: str - :keyword direction: The rule's direction. Known values are: "Inbound" and "Outbound". - :paramtype direction: str or ~azure.mgmt.security.v2020_01_01.models.Direction - :keyword destination_port: The rule's destination port. - :paramtype destination_port: int - :keyword protocols: The rule's transport protocols. - :paramtype protocols: list[str or ~azure.mgmt.security.v2020_01_01.models.TransportProtocol] - :keyword ip_addresses: The remote IP addresses that should be able to communicate with the - Azure resource on the rule's destination port and protocol. - :paramtype ip_addresses: list[str] - """ - super().__init__(**kwargs) - self.name = name - self.direction = direction - self.destination_port = destination_port - self.protocols = protocols - self.ip_addresses = ip_addresses - - class SecureScoreControlDefinitionItem(Resource): """Information about the security control. @@ -3654,96 +3071,3 @@ def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.resource_id = None - - -class UserRecommendation(_serialization.Model): - """Represents a user that is recommended to be allowed for a certain rule. - - :ivar username: Represents a user that is recommended to be allowed for a certain rule. - :vartype username: str - :ivar recommendation_action: The recommendation action of the machine or rule. Known values - are: "Recommended", "Add", and "Remove". - :vartype recommendation_action: str or - ~azure.mgmt.security.v2020_01_01.models.RecommendationAction - """ - - _attribute_map = { - "username": {"key": "username", "type": "str"}, - "recommendation_action": {"key": "recommendationAction", "type": "str"}, - } - - def __init__( - self, - *, - username: Optional[str] = None, - recommendation_action: Optional[Union[str, "_models.RecommendationAction"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword username: Represents a user that is recommended to be allowed for a certain rule. - :paramtype username: str - :keyword recommendation_action: The recommendation action of the machine or rule. Known values - are: "Recommended", "Add", and "Remove". - :paramtype recommendation_action: str or - ~azure.mgmt.security.v2020_01_01.models.RecommendationAction - """ - super().__init__(**kwargs) - self.username = username - self.recommendation_action = recommendation_action - - -class VmRecommendation(_serialization.Model): - """Represents a machine that is part of a machine group. - - :ivar configuration_status: The configuration status of the machines group or machine or rule. - Known values are: "Configured", "NotConfigured", "InProgress", "Failed", and "NoStatus". - :vartype configuration_status: str or - ~azure.mgmt.security.v2020_01_01.models.ConfigurationStatus - :ivar recommendation_action: The recommendation action of the machine or rule. Known values - are: "Recommended", "Add", and "Remove". - :vartype recommendation_action: str or - ~azure.mgmt.security.v2020_01_01.models.RecommendationAction - :ivar resource_id: The full resource id of the machine. - :vartype resource_id: str - :ivar enforcement_support: The machine supportability of Enforce feature. Known values are: - "Supported", "NotSupported", and "Unknown". - :vartype enforcement_support: str or ~azure.mgmt.security.v2020_01_01.models.EnforcementSupport - """ - - _attribute_map = { - "configuration_status": {"key": "configurationStatus", "type": "str"}, - "recommendation_action": {"key": "recommendationAction", "type": "str"}, - "resource_id": {"key": "resourceId", "type": "str"}, - "enforcement_support": {"key": "enforcementSupport", "type": "str"}, - } - - def __init__( - self, - *, - configuration_status: Optional[Union[str, "_models.ConfigurationStatus"]] = None, - recommendation_action: Optional[Union[str, "_models.RecommendationAction"]] = None, - resource_id: Optional[str] = None, - enforcement_support: Optional[Union[str, "_models.EnforcementSupport"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword configuration_status: The configuration status of the machines group or machine or - rule. Known values are: "Configured", "NotConfigured", "InProgress", "Failed", and "NoStatus". - :paramtype configuration_status: str or - ~azure.mgmt.security.v2020_01_01.models.ConfigurationStatus - :keyword recommendation_action: The recommendation action of the machine or rule. Known values - are: "Recommended", "Add", and "Remove". - :paramtype recommendation_action: str or - ~azure.mgmt.security.v2020_01_01.models.RecommendationAction - :keyword resource_id: The full resource id of the machine. - :paramtype resource_id: str - :keyword enforcement_support: The machine supportability of Enforce feature. Known values are: - "Supported", "NotSupported", and "Unknown". - :paramtype enforcement_support: str or - ~azure.mgmt.security.v2020_01_01.models.EnforcementSupport - """ - super().__init__(**kwargs) - self.configuration_status = configuration_status - self.recommendation_action = recommendation_action - self.resource_id = resource_id - self.enforcement_support = enforcement_support diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/_security_center_enums.py index b1dde3e34bcc..b169d4be3b1c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/_security_center_enums.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/models/_security_center_enums.py @@ -18,17 +18,6 @@ class AadConnectivityStateEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): CONNECTED = "Connected" -class AdaptiveApplicationControlIssue(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """An alert that machines within a group can have.""" - - VIOLATIONS_AUDITED = "ViolationsAudited" - VIOLATIONS_BLOCKED = "ViolationsBlocked" - MSI_AND_SCRIPT_VIOLATIONS_AUDITED = "MsiAndScriptViolationsAudited" - MSI_AND_SCRIPT_VIOLATIONS_BLOCKED = "MsiAndScriptViolationsBlocked" - EXECUTABLE_VIOLATIONS_AUDITED = "ExecutableViolationsAudited" - RULES_VIOLATED_MANUALLY = "RulesViolatedManually" - - class AssessmentStatusCode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Programmatic code for the status of the assessment.""" @@ -67,16 +56,6 @@ class Categories(str, Enum, metaclass=CaseInsensitiveEnumMeta): IO_T = "IoT" -class ConfigurationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The configuration status of the machines group or machine or rule.""" - - CONFIGURED = "Configured" - NOT_CONFIGURED = "NotConfigured" - IN_PROGRESS = "InProgress" - FAILED = "Failed" - NO_STATUS = "NoStatus" - - class ConnectionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ConnectionType.""" @@ -93,29 +72,6 @@ class ControlType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Non Microsoft Defender for Cloud managed assessments""" -class Direction(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The rule's direction.""" - - INBOUND = "Inbound" - OUTBOUND = "Outbound" - - -class EnforcementMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The application control policy enforcement/protection mode of the machine group.""" - - AUDIT = "Audit" - ENFORCE = "Enforce" - NONE = "None" - - -class EnforcementSupport(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The machine supportability of Enforce feature.""" - - SUPPORTED = "Supported" - NOT_SUPPORTED = "NotSupported" - UNKNOWN = "Unknown" - - class ExpandControlsEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ExpandControlsEnum.""" @@ -140,17 +96,6 @@ class ExternalSecuritySolutionKindEnum(str, Enum, metaclass=CaseInsensitiveEnumM AAD = "AAD" -class FileType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the file (for Linux files - Executable is used).""" - - EXE = "Exe" - DLL = "Dll" - MSI = "Msi" - SCRIPT = "Script" - EXECUTABLE = "Executable" - UNKNOWN = "Unknown" - - class ImplementationEffort(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The implementation effort required to remediate this assessment.""" @@ -175,34 +120,6 @@ class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): UPDATING = "Updating" -class RecommendationAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The recommendation action of the machine or rule.""" - - RECOMMENDED = "Recommended" - ADD = "Add" - REMOVE = "Remove" - - -class RecommendationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The initial recommendation status of the machine group or machine.""" - - RECOMMENDED = "Recommended" - NOT_RECOMMENDED = "NotRecommended" - NOT_AVAILABLE = "NotAvailable" - NO_STATUS = "NoStatus" - - -class RecommendationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the rule to be allowed.""" - - FILE = "File" - FILE_HASH = "FileHash" - PUBLISHER_SIGNATURE = "PublisherSignature" - PRODUCT_SIGNATURE = "ProductSignature" - BINARY_SIGNATURE = "BinarySignature" - VERSION_AND_ABOVE_SIGNATURE = "VersionAndAboveSignature" - - class SecurityFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The security family of the discovered solution.""" @@ -241,16 +158,6 @@ class Source(str, Enum, metaclass=CaseInsensitiveEnumMeta): """SQL Resource in an on premise machine connected to Azure cloud""" -class SourceSystem(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The source type of the machine group.""" - - AZURE_APP_LOCKER = "Azure_AppLocker" - AZURE_AUDIT_D = "Azure_AuditD" - NON_AZURE_APP_LOCKER = "NonAzure_AppLocker" - NON_AZURE_AUDIT_D = "NonAzure_AuditD" - NONE = "None" - - class Status(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The status of the port.""" @@ -279,13 +186,6 @@ class Threats(str, Enum, metaclass=CaseInsensitiveEnumMeta): DENIAL_OF_SERVICE = "denialOfService" -class TransportProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """TransportProtocol.""" - - TCP = "TCP" - UDP = "UDP" - - class UserImpact(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The user impact of the assessment.""" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/__init__.py index a3d32683f78c..135428241701 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/__init__.py @@ -6,9 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._adaptive_network_hardenings_operations import AdaptiveNetworkHardeningsOperations from ._allowed_connections_operations import AllowedConnectionsOperations -from ._adaptive_application_controls_operations import AdaptiveApplicationControlsOperations from ._assessments_metadata_operations import AssessmentsMetadataOperations from ._assessments_operations import AssessmentsOperations from ._discovered_security_solutions_operations import DiscoveredSecuritySolutionsOperations @@ -27,9 +25,7 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "AdaptiveNetworkHardeningsOperations", "AllowedConnectionsOperations", - "AdaptiveApplicationControlsOperations", "AssessmentsMetadataOperations", "AssessmentsOperations", "DiscoveredSecuritySolutionsOperations", diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_adaptive_application_controls_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_adaptive_application_controls_operations.py deleted file mode 100644 index 0b44a5ac4827..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_adaptive_application_controls_operations.py +++ /dev/null @@ -1,495 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - 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 .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -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, - *, - include_path_recommendations: Optional[bool] = None, - summary: Optional[bool] = None, - **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", "2020-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applicationWhitelistings" - ) # 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}$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if include_path_recommendations is not None: - _params["includePathRecommendations"] = _SERIALIZER.query( - "include_path_recommendations", include_path_recommendations, "bool" - ) - if summary is not None: - _params["summary"] = _SERIALIZER.query("summary", summary, "bool") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(asc_location: str, group_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", "2020-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}", - ) # 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}$" - ), - "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), - "groupName": _SERIALIZER.url("group_name", group_name, "str"), - } - - _url: str = _url.format(**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_put_request(asc_location: str, group_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", "2020-01-01")) - 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/locations/{ascLocation}/applicationWhitelistings/{groupName}", - ) # 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}$" - ), - "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), - "groupName": _SERIALIZER.url("group_name", group_name, "str"), - } - - _url: str = _url.format(**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(asc_location: str, group_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", "2020-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}", - ) # 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}$" - ), - "ascLocation": _SERIALIZER.url("asc_location", asc_location, "str"), - "groupName": _SERIALIZER.url("group_name", group_name, "str"), - } - - _url: str = _url.format(**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) - - -class AdaptiveApplicationControlsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.security.v2020_01_01.SecurityCenter`'s - :attr:`adaptive_application_controls` 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") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list( - self, include_path_recommendations: Optional[bool] = None, summary: Optional[bool] = None, **kwargs: Any - ) -> _models.AdaptiveApplicationControlGroups: - """Gets a list of application control machine groups for the subscription. - - :param include_path_recommendations: Include the policy rules. Default value is None. - :type include_path_recommendations: bool - :param summary: Return output in a summarized form. Default value is None. - :type summary: bool - :return: AdaptiveApplicationControlGroups or the result of cls(response) - :rtype: ~azure.mgmt.security.v2020_01_01.models.AdaptiveApplicationControlGroups - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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", self._api_version or "2020-01-01")) - cls: ClsType[_models.AdaptiveApplicationControlGroups] = kwargs.pop("cls", None) - - _request = build_list_request( - subscription_id=self._config.subscription_id, - include_path_recommendations=include_path_recommendations, - summary=summary, - api_version=api_version, - 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("AdaptiveApplicationControlGroups", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get(self, asc_location: str, group_name: str, **kwargs: Any) -> _models.AdaptiveApplicationControlGroup: - """Gets an application control VM/server group. - - :param asc_location: The location where ASC stores the data of the subscription. can be - retrieved from Get locations. Required. - :type asc_location: str - :param group_name: Name of an application control machine group. Required. - :type group_name: str - :return: AdaptiveApplicationControlGroup or the result of cls(response) - :rtype: ~azure.mgmt.security.v2020_01_01.models.AdaptiveApplicationControlGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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", self._api_version or "2020-01-01")) - cls: ClsType[_models.AdaptiveApplicationControlGroup] = kwargs.pop("cls", None) - - _request = build_get_request( - asc_location=asc_location, - group_name=group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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("AdaptiveApplicationControlGroup", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def put( - self, - asc_location: str, - group_name: str, - body: _models.AdaptiveApplicationControlGroup, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AdaptiveApplicationControlGroup: - """Update an application control machine group. - - :param asc_location: The location where ASC stores the data of the subscription. can be - retrieved from Get locations. Required. - :type asc_location: str - :param group_name: Name of an application control machine group. Required. - :type group_name: str - :param body: Required. - :type body: ~azure.mgmt.security.v2020_01_01.models.AdaptiveApplicationControlGroup - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: AdaptiveApplicationControlGroup or the result of cls(response) - :rtype: ~azure.mgmt.security.v2020_01_01.models.AdaptiveApplicationControlGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put( - self, - asc_location: str, - group_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.AdaptiveApplicationControlGroup: - """Update an application control machine group. - - :param asc_location: The location where ASC stores the data of the subscription. can be - retrieved from Get locations. Required. - :type asc_location: str - :param group_name: Name of an application control machine group. Required. - :type group_name: str - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: AdaptiveApplicationControlGroup or the result of cls(response) - :rtype: ~azure.mgmt.security.v2020_01_01.models.AdaptiveApplicationControlGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put( - self, - asc_location: str, - group_name: str, - body: Union[_models.AdaptiveApplicationControlGroup, IO[bytes]], - **kwargs: Any - ) -> _models.AdaptiveApplicationControlGroup: - """Update an application control machine group. - - :param asc_location: The location where ASC stores the data of the subscription. can be - retrieved from Get locations. Required. - :type asc_location: str - :param group_name: Name of an application control machine group. Required. - :type group_name: str - :param body: Is either a AdaptiveApplicationControlGroup type or a IO[bytes] type. Required. - :type body: ~azure.mgmt.security.v2020_01_01.models.AdaptiveApplicationControlGroup or - IO[bytes] - :return: AdaptiveApplicationControlGroup or the result of cls(response) - :rtype: ~azure.mgmt.security.v2020_01_01.models.AdaptiveApplicationControlGroup - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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", self._api_version or "2020-01-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AdaptiveApplicationControlGroup] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _json = self._serialize.body(body, "AdaptiveApplicationControlGroup") - - _request = build_put_request( - asc_location=asc_location, - group_name=group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - 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("AdaptiveApplicationControlGroup", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, asc_location: str, group_name: str, **kwargs: Any - ) -> None: - """Delete an application control machine group. - - :param asc_location: The location where ASC stores the data of the subscription. can be - retrieved from Get locations. Required. - :type asc_location: str - :param group_name: Name of an application control machine group. Required. - :type group_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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", self._api_version or "2020-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - asc_location=asc_location, - group_name=group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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, 202, 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, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_adaptive_network_hardenings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_adaptive_network_hardenings_operations.py deleted file mode 100644 index aa19503ecf1d..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_adaptive_network_hardenings_operations.py +++ /dev/null @@ -1,599 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, Type, TypeVar, Union, cast, 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.polling import LROPoller, NoPolling, PollingMethod -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 azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer -from .._vendor import _convert_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_extended_resource_request( - resource_group_name: str, - resource_namespace: str, - resource_type: str, - resource_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", "2020-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings", - ) # 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}$" - ), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "resourceNamespace": _SERIALIZER.url("resource_namespace", resource_namespace, "str"), - "resourceType": _SERIALIZER.url("resource_type", resource_type, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - } - - _url: str = _url.format(**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( - resource_group_name: str, - resource_namespace: str, - resource_type: str, - resource_name: str, - adaptive_network_hardening_resource_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", "2020-01-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}", - ) # 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}$" - ), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "resourceNamespace": _SERIALIZER.url("resource_namespace", resource_namespace, "str"), - "resourceType": _SERIALIZER.url("resource_type", resource_type, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "adaptiveNetworkHardeningResourceName": _SERIALIZER.url( - "adaptive_network_hardening_resource_name", adaptive_network_hardening_resource_name, "str" - ), - } - - _url: str = _url.format(**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_enforce_request( - resource_group_name: str, - resource_namespace: str, - resource_type: str, - resource_name: str, - adaptive_network_hardening_resource_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - adaptive_network_hardening_enforce_action: Literal["enforce"] = kwargs.pop( - "adaptive_network_hardening_enforce_action", "enforce" - ) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2020-01-01")) - 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}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}/{adaptiveNetworkHardeningEnforceAction}", - ) # 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}$" - ), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "resourceNamespace": _SERIALIZER.url("resource_namespace", resource_namespace, "str"), - "resourceType": _SERIALIZER.url("resource_type", resource_type, "str"), - "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), - "adaptiveNetworkHardeningResourceName": _SERIALIZER.url( - "adaptive_network_hardening_resource_name", adaptive_network_hardening_resource_name, "str" - ), - "adaptiveNetworkHardeningEnforceAction": _SERIALIZER.url( - "adaptive_network_hardening_enforce_action", adaptive_network_hardening_enforce_action, "str" - ), - } - - _url: str = _url.format(**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="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class AdaptiveNetworkHardeningsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.security.v2020_01_01.SecurityCenter`'s - :attr:`adaptive_network_hardenings` 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") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_extended_resource( - self, resource_group_name: str, resource_namespace: str, resource_type: str, resource_name: str, **kwargs: Any - ) -> Iterable["_models.AdaptiveNetworkHardening"]: - """Gets a list of Adaptive Network Hardenings resources in scope of an extended resource. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param resource_namespace: The Namespace of the resource. Required. - :type resource_namespace: str - :param resource_type: The type of the resource. Required. - :type resource_type: str - :param resource_name: Name of the resource. Required. - :type resource_name: str - :return: An iterator like instance of either AdaptiveNetworkHardening or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.security.v2020_01_01.models.AdaptiveNetworkHardening] - :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", self._api_version or "2020-01-01")) - cls: ClsType[_models.AdaptiveNetworkHardeningsList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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_by_extended_resource_request( - resource_group_name=resource_group_name, - resource_namespace=resource_namespace, - resource_type=resource_type, - resource_name=resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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._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("AdaptiveNetworkHardeningsList", 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) - - @distributed_trace - def get( - self, - resource_group_name: str, - resource_namespace: str, - resource_type: str, - resource_name: str, - adaptive_network_hardening_resource_name: str, - **kwargs: Any - ) -> _models.AdaptiveNetworkHardening: - """Gets a single Adaptive Network Hardening resource. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param resource_namespace: The Namespace of the resource. Required. - :type resource_namespace: str - :param resource_type: The type of the resource. Required. - :type resource_type: str - :param resource_name: Name of the resource. Required. - :type resource_name: str - :param adaptive_network_hardening_resource_name: The name of the Adaptive Network Hardening - resource. Required. - :type adaptive_network_hardening_resource_name: str - :return: AdaptiveNetworkHardening or the result of cls(response) - :rtype: ~azure.mgmt.security.v2020_01_01.models.AdaptiveNetworkHardening - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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", self._api_version or "2020-01-01")) - cls: ClsType[_models.AdaptiveNetworkHardening] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - resource_namespace=resource_namespace, - resource_type=resource_type, - resource_name=resource_name, - adaptive_network_hardening_resource_name=adaptive_network_hardening_resource_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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("AdaptiveNetworkHardening", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _enforce_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - resource_namespace: str, - resource_type: str, - resource_name: str, - adaptive_network_hardening_resource_name: str, - body: Union[_models.AdaptiveNetworkHardeningEnforceRequest, IO[bytes]], - **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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 {}) - - adaptive_network_hardening_enforce_action: Literal["enforce"] = kwargs.pop( - "adaptive_network_hardening_enforce_action", "enforce" - ) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _json = self._serialize.body(body, "AdaptiveNetworkHardeningEnforceRequest") - - _request = build_enforce_request( - resource_group_name=resource_group_name, - resource_namespace=resource_namespace, - resource_type=resource_type, - resource_name=resource_name, - adaptive_network_hardening_resource_name=adaptive_network_hardening_resource_name, - subscription_id=self._config.subscription_id, - adaptive_network_hardening_enforce_action=adaptive_network_hardening_enforce_action, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - 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, 202]: - 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, {}) # type: ignore - - @overload - def begin_enforce( - self, - resource_group_name: str, - resource_namespace: str, - resource_type: str, - resource_name: str, - adaptive_network_hardening_resource_name: str, - body: _models.AdaptiveNetworkHardeningEnforceRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Enforces the given rules on the NSG(s) listed in the request. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param resource_namespace: The Namespace of the resource. Required. - :type resource_namespace: str - :param resource_type: The type of the resource. Required. - :type resource_type: str - :param resource_name: Name of the resource. Required. - :type resource_name: str - :param adaptive_network_hardening_resource_name: The name of the Adaptive Network Hardening - resource. Required. - :type adaptive_network_hardening_resource_name: str - :param body: Required. - :type body: ~azure.mgmt.security.v2020_01_01.models.AdaptiveNetworkHardeningEnforceRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_enforce( - self, - resource_group_name: str, - resource_namespace: str, - resource_type: str, - resource_name: str, - adaptive_network_hardening_resource_name: str, - body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Enforces the given rules on the NSG(s) listed in the request. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param resource_namespace: The Namespace of the resource. Required. - :type resource_namespace: str - :param resource_type: The type of the resource. Required. - :type resource_type: str - :param resource_name: Name of the resource. Required. - :type resource_name: str - :param adaptive_network_hardening_resource_name: The name of the Adaptive Network Hardening - resource. Required. - :type adaptive_network_hardening_resource_name: str - :param body: Required. - :type body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_enforce( - self, - resource_group_name: str, - resource_namespace: str, - resource_type: str, - resource_name: str, - adaptive_network_hardening_resource_name: str, - body: Union[_models.AdaptiveNetworkHardeningEnforceRequest, IO[bytes]], - **kwargs: Any - ) -> LROPoller[None]: - """Enforces the given rules on the NSG(s) listed in the request. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param resource_namespace: The Namespace of the resource. Required. - :type resource_namespace: str - :param resource_type: The type of the resource. Required. - :type resource_type: str - :param resource_name: Name of the resource. Required. - :type resource_name: str - :param adaptive_network_hardening_resource_name: The name of the Adaptive Network Hardening - resource. Required. - :type adaptive_network_hardening_resource_name: str - :param body: Is either a AdaptiveNetworkHardeningEnforceRequest type or a IO[bytes] type. - Required. - :type body: ~azure.mgmt.security.v2020_01_01.models.AdaptiveNetworkHardeningEnforceRequest or - IO[bytes] - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - adaptive_network_hardening_enforce_action: Literal["enforce"] = kwargs.pop( - "adaptive_network_hardening_enforce_action", "enforce" - ) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._enforce_initial( # type: ignore - resource_group_name=resource_group_name, - resource_namespace=resource_namespace, - resource_type=resource_type, - resource_name=resource_name, - adaptive_network_hardening_resource_name=adaptive_network_hardening_resource_name, - body=body, - adaptive_network_hardening_enforce_action=adaptive_network_hardening_enforce_action, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_allowed_connections_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_allowed_connections_operations.py index 7385926cbf12..410f10aff456 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_allowed_connections_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_allowed_connections_operations.py @@ -20,15 +20,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -190,7 +188,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -206,7 +203,6 @@ def prepare_request(next_link=None): _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 @@ -272,7 +268,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -288,7 +283,6 @@ def prepare_request(next_link=None): _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 @@ -364,7 +358,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -378,7 +371,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("AllowedConnectionsResource", pipeline_response) + deserialized = self._deserialize("AllowedConnectionsResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_assessments_metadata_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_assessments_metadata_operations.py index 6a0c9a9d4ad6..84da2ada7a7c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_assessments_metadata_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_assessments_metadata_operations.py @@ -21,15 +21,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -262,7 +260,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -278,7 +275,6 @@ def prepare_request(next_link=None): _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 @@ -338,7 +334,6 @@ def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.SecurityA headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -352,7 +347,7 @@ def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.SecurityA map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityAssessmentMetadata", pipeline_response) + deserialized = self._deserialize("SecurityAssessmentMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -392,7 +387,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -408,7 +402,6 @@ def prepare_request(next_link=None): _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 @@ -469,7 +462,6 @@ def get_in_subscription(self, assessment_metadata_name: str, **kwargs: Any) -> _ headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -483,7 +475,7 @@ def get_in_subscription(self, assessment_metadata_name: str, **kwargs: Any) -> _ map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityAssessmentMetadata", pipeline_response) + deserialized = self._deserialize("SecurityAssessmentMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -591,7 +583,6 @@ def create_in_subscription( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -605,7 +596,7 @@ def create_in_subscription( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityAssessmentMetadata", pipeline_response) + deserialized = self._deserialize("SecurityAssessmentMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -647,7 +638,6 @@ def delete_in_subscription( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_assessments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_assessments_operations.py index fa43db36667a..d593af0786a1 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_assessments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_assessments_operations.py @@ -21,15 +21,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -204,7 +202,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -220,7 +217,6 @@ def prepare_request(next_link=None): _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 @@ -292,7 +288,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -306,7 +301,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityAssessment", pipeline_response) + deserialized = self._deserialize("SecurityAssessment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -422,7 +417,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -436,11 +430,7 @@ def create_or_update( 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("SecurityAssessment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SecurityAssessment", pipeline_response) + deserialized = self._deserialize("SecurityAssessment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -483,7 +473,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_discovered_security_solutions_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_discovered_security_solutions_operations.py index a3f605075da7..8f16dd18f310 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_discovered_security_solutions_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_discovered_security_solutions_operations.py @@ -20,15 +20,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -194,7 +192,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -210,7 +207,6 @@ def prepare_request(next_link=None): _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 @@ -276,7 +272,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -292,7 +287,6 @@ def prepare_request(next_link=None): _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 @@ -362,7 +356,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -376,7 +369,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DiscoveredSecuritySolution", pipeline_response) + deserialized = self._deserialize("DiscoveredSecuritySolution", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_external_security_solutions_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_external_security_solutions_operations.py index f1a6761434a6..1a5fb2cb5bca 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_external_security_solutions_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_external_security_solutions_operations.py @@ -20,15 +20,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -194,7 +192,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -210,7 +207,6 @@ def prepare_request(next_link=None): _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 @@ -276,7 +272,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -292,7 +287,6 @@ def prepare_request(next_link=None): _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 @@ -362,7 +356,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -376,7 +369,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ExternalSecuritySolution", pipeline_response) + deserialized = self._deserialize("ExternalSecuritySolution", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_jit_network_access_policies_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_jit_network_access_policies_operations.py index 26a8baeac23d..82bcc7c1ed98 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_jit_network_access_policies_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_jit_network_access_policies_operations.py @@ -21,15 +21,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -400,7 +398,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -416,7 +413,6 @@ def prepare_request(next_link=None): _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 @@ -483,7 +479,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -499,7 +494,6 @@ def prepare_request(next_link=None): _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 @@ -568,7 +562,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -584,7 +577,6 @@ def prepare_request(next_link=None): _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 @@ -657,7 +649,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -673,7 +664,6 @@ def prepare_request(next_link=None): _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 @@ -745,7 +735,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -759,7 +748,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("JitNetworkAccessPolicy", pipeline_response) + deserialized = self._deserialize("JitNetworkAccessPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -891,7 +880,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -905,7 +893,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("JitNetworkAccessPolicy", pipeline_response) + deserialized = self._deserialize("JitNetworkAccessPolicy", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -954,7 +942,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1102,7 +1089,6 @@ def initiate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1116,7 +1102,7 @@ def initiate( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("JitNetworkAccessRequest", pipeline_response) + deserialized = self._deserialize("JitNetworkAccessRequest", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_score_control_definitions_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_score_control_definitions_operations.py index e37db2ddbc18..a98694f4f399 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_score_control_definitions_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_score_control_definitions_operations.py @@ -20,15 +20,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -140,7 +138,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -156,7 +153,6 @@ def prepare_request(next_link=None): _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 @@ -219,7 +215,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -235,7 +230,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_score_controls_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_score_controls_operations.py index b05b40b84fd8..623f5d5e6bfd 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_score_controls_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_score_controls_operations.py @@ -20,15 +20,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -173,7 +171,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -189,7 +186,6 @@ def prepare_request(next_link=None): _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 @@ -256,7 +252,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -272,7 +267,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_scores_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_scores_operations.py index d490ae664ead..40d9ec764bb0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_scores_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_secure_scores_operations.py @@ -20,15 +20,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -148,7 +146,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -164,7 +161,6 @@ def prepare_request(next_link=None): _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 @@ -226,7 +222,6 @@ def get(self, secure_score_name: str, **kwargs: Any) -> _models.SecureScoreItem: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -240,7 +235,7 @@ def get(self, secure_score_name: str, **kwargs: Any) -> _models.SecureScoreItem: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecureScoreItem", pipeline_response) + deserialized = self._deserialize("SecureScoreItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_security_solutions_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_security_solutions_operations.py index 0f543359de7e..175441a0da9f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_security_solutions_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_security_solutions_operations.py @@ -20,15 +20,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -154,7 +152,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -170,7 +167,6 @@ def prepare_request(next_link=None): _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 @@ -240,7 +236,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -254,7 +249,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecuritySolution", pipeline_response) + deserialized = self._deserialize("SecuritySolution", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_security_solutions_reference_data_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_security_solutions_reference_data_operations.py index 841cc9a078ae..f52d081dc3a6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_security_solutions_reference_data_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_security_solutions_reference_data_operations.py @@ -18,15 +18,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -145,7 +143,6 @@ def list(self, **kwargs: Any) -> _models.SecuritySolutionsReferenceDataList: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -159,7 +156,7 @@ def list(self, **kwargs: Any) -> _models.SecuritySolutionsReferenceDataList: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecuritySolutionsReferenceDataList", pipeline_response) + deserialized = self._deserialize("SecuritySolutionsReferenceDataList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -198,7 +195,6 @@ def list_by_home_region(self, asc_location: str, **kwargs: Any) -> _models.Secur headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -212,7 +208,7 @@ def list_by_home_region(self, asc_location: str, **kwargs: Any) -> _models.Secur map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecuritySolutionsReferenceDataList", pipeline_response) + deserialized = self._deserialize("SecuritySolutionsReferenceDataList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_server_vulnerability_assessment_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_server_vulnerability_assessment_operations.py index 234fe401556e..bbc69e61156c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_server_vulnerability_assessment_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_server_vulnerability_assessment_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Literal, Optional, Type, TypeVar, Union, cast +from typing import Any, Callable, Dict, Iterator, Literal, Optional, Type, TypeVar, Union, cast from azure.core.exceptions import ( ClientAuthenticationError, @@ -15,12 +15,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -28,7 +29,6 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -284,7 +284,6 @@ def list_by_extended_resource( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -298,7 +297,7 @@ def list_by_extended_resource( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServerVulnerabilityAssessmentsList", pipeline_response) + deserialized = self._deserialize("ServerVulnerabilityAssessmentsList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -350,7 +349,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -364,7 +362,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServerVulnerabilityAssessment", pipeline_response) + deserialized = self._deserialize("ServerVulnerabilityAssessment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -417,7 +415,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -431,16 +428,16 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServerVulnerabilityAssessment", pipeline_response) + deserialized = self._deserialize("ServerVulnerabilityAssessment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + def _delete_initial( self, resource_group_name: str, resource_namespace: str, resource_type: str, resource_name: str, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -454,7 +451,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements server_vulnerability_assessment: Literal["default"] = kwargs.pop("server_vulnerability_assessment", "default") api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2020-01-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -467,10 +464,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -478,11 +475,19 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -513,7 +518,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, resource_namespace=resource_namespace, resource_type=resource_type, @@ -525,6 +530,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_topology_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_topology_operations.py index bae076872e9a..22e7356eea34 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_topology_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01/operations/_topology_operations.py @@ -20,15 +20,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -184,7 +182,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -200,7 +197,6 @@ def prepare_request(next_link=None): _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 @@ -264,7 +260,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -280,7 +275,6 @@ def prepare_request(next_link=None): _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 @@ -350,7 +344,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -364,7 +357,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("TopologyResource", pipeline_response) + deserialized = self._deserialize("TopologyResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_metadata.json index adac1855666d..6b4379570332 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_security_center.py index ac1dbc89b264..4dadf9347235 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -107,7 +108,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SecurityCenter": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_vendor.py +++ /dev/null @@ -1,16 +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 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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/_security_center.py index e28ed4b8fec1..834019da9dd9 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -110,7 +111,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SecurityCenter": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/operations/_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/operations/_connectors_operations.py index 21678e8b0fb6..ba612bac284c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/operations/_connectors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/operations/_connectors_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._connectors_operations import ( build_create_or_update_request, build_delete_request, @@ -99,7 +97,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -115,7 +112,6 @@ def prepare_request(next_link=None): _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 @@ -177,7 +173,6 @@ async def get(self, connector_name: str, **kwargs: Any) -> _models.ConnectorSett headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -191,7 +186,7 @@ async def get(self, connector_name: str, **kwargs: Any) -> _models.ConnectorSett map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectorSetting", pipeline_response) + deserialized = self._deserialize("ConnectorSetting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -301,7 +296,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -315,7 +309,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectorSetting", pipeline_response) + deserialized = self._deserialize("ConnectorSetting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -357,7 +351,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/operations/_security_contacts_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/operations/_security_contacts_operations.py index 95f4723da89a..0e723e571fb7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/operations/_security_contacts_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/aio/operations/_security_contacts_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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_contacts_operations import ( build_create_request, build_delete_request, @@ -99,7 +97,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -115,7 +112,6 @@ def prepare_request(next_link=None): _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 @@ -177,7 +173,6 @@ async def get(self, security_contact_name: str, **kwargs: Any) -> _models.Securi headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -191,7 +186,7 @@ async def get(self, security_contact_name: str, **kwargs: Any) -> _models.Securi map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityContact", pipeline_response) + deserialized = self._deserialize("SecurityContact", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -295,7 +290,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -309,11 +303,7 @@ async def create( 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("SecurityContact", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SecurityContact", pipeline_response) + deserialized = self._deserialize("SecurityContact", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -355,7 +345,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/operations/_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/operations/_connectors_operations.py index 556ef2fc0745..5f96b9f14a73 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/operations/_connectors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/operations/_connectors_operations.py @@ -21,15 +21,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -212,7 +210,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -228,7 +225,6 @@ def prepare_request(next_link=None): _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 @@ -290,7 +286,6 @@ def get(self, connector_name: str, **kwargs: Any) -> _models.ConnectorSetting: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -304,7 +299,7 @@ def get(self, connector_name: str, **kwargs: Any) -> _models.ConnectorSetting: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectorSetting", pipeline_response) + deserialized = self._deserialize("ConnectorSetting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -414,7 +409,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -428,7 +422,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ConnectorSetting", pipeline_response) + deserialized = self._deserialize("ConnectorSetting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -468,7 +462,6 @@ def delete(self, connector_name: str, **kwargs: Any) -> None: # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/operations/_security_contacts_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/operations/_security_contacts_operations.py index 1a201f75af07..4302ebd91f03 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/operations/_security_contacts_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_01_01_preview/operations/_security_contacts_operations.py @@ -21,15 +21,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -215,7 +213,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -231,7 +228,6 @@ def prepare_request(next_link=None): _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 @@ -293,7 +289,6 @@ def get(self, security_contact_name: str, **kwargs: Any) -> _models.SecurityCont headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -307,7 +302,7 @@ def get(self, security_contact_name: str, **kwargs: Any) -> _models.SecurityCont map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityContact", pipeline_response) + deserialized = self._deserialize("SecurityContact", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -411,7 +406,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -425,11 +419,7 @@ def create( 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("SecurityContact", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SecurityContact", pipeline_response) + deserialized = self._deserialize("SecurityContact", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -471,7 +461,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_metadata.json index 6f17ca10a254..91a52e7a58c3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_security_center.py index 8bf1a6399f6d..3db723338adb 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -114,7 +115,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SecurityCenter": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_vendor.py +++ /dev/null @@ -1,16 +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 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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/_security_center.py index a2c246ebf205..529b0d7c1648 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -116,7 +117,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SecurityCenter": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_baseline_rules_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_baseline_rules_operations.py index 49859e71f70e..f38f19544b1a 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_baseline_rules_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_baseline_rules_operations.py @@ -19,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 -from ..._vendor import _convert_request from ...operations._sql_vulnerability_assessment_baseline_rules_operations import ( build_add_request, build_create_or_update_request, @@ -190,7 +188,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -204,7 +201,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RuleResults", pipeline_response) + deserialized = self._deserialize("RuleResults", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -251,7 +248,6 @@ async def get(self, rule_id: str, workspace_id: str, resource_id: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -265,7 +261,7 @@ async def get(self, rule_id: str, workspace_id: str, resource_id: str, **kwargs: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RuleResults", pipeline_response) + deserialized = self._deserialize("RuleResults", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -314,7 +310,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -368,7 +363,6 @@ async def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _mod headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -382,7 +376,7 @@ async def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _mod map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RulesResults", pipeline_response) + deserialized = self._deserialize("RulesResults", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -506,7 +500,6 @@ async def add( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -520,7 +513,7 @@ async def add( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RulesResults", pipeline_response) + deserialized = self._deserialize("RulesResults", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_scan_results_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_scan_results_operations.py index 1afe7abbb6fd..3c926892b646 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_scan_results_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_scan_results_operations.py @@ -18,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 -from ..._vendor import _convert_request from ...operations._sql_vulnerability_assessment_scan_results_operations import build_get_request, build_list_request if sys.version_info >= (3, 9): @@ -102,7 +100,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -116,7 +113,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ScanResult", pipeline_response) + deserialized = self._deserialize("ScanResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -164,7 +161,6 @@ async def list(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -178,7 +174,7 @@ async def list(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ScanResults", pipeline_response) + deserialized = self._deserialize("ScanResults", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_scans_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_scans_operations.py index 3646f306a54d..912e9cffbbcd 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_scans_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/aio/operations/_sql_vulnerability_assessment_scans_operations.py @@ -18,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 -from ..._vendor import _convert_request from ...operations._sql_vulnerability_assessment_scans_operations import build_get_request, build_list_request if sys.version_info >= (3, 9): @@ -97,7 +95,6 @@ async def get(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -111,7 +108,7 @@ async def get(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Scan", pipeline_response) + deserialized = self._deserialize("Scan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -155,7 +152,6 @@ async def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _mod headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -169,7 +165,7 @@ async def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _mod map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Scans", pipeline_response) + deserialized = self._deserialize("Scans", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_baseline_rules_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_baseline_rules_operations.py index 529c08d706aa..afa2fe1dbe9c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_baseline_rules_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_baseline_rules_operations.py @@ -19,15 +19,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -334,7 +332,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -348,7 +345,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RuleResults", pipeline_response) + deserialized = self._deserialize("RuleResults", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -395,7 +392,6 @@ def get(self, rule_id: str, workspace_id: str, resource_id: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -409,7 +405,7 @@ def get(self, rule_id: str, workspace_id: str, resource_id: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RuleResults", pipeline_response) + deserialized = self._deserialize("RuleResults", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -458,7 +454,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -512,7 +507,6 @@ def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.Ru headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -526,7 +520,7 @@ def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.Ru map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RulesResults", pipeline_response) + deserialized = self._deserialize("RulesResults", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -650,7 +644,6 @@ def add( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -664,7 +657,7 @@ def add( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RulesResults", pipeline_response) + deserialized = self._deserialize("RulesResults", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_scan_results_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_scan_results_operations.py index e399139c92f8..40d9c6f37ecb 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_scan_results_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_scan_results_operations.py @@ -18,15 +18,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -166,7 +164,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -180,7 +177,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ScanResult", pipeline_response) + deserialized = self._deserialize("ScanResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -228,7 +225,6 @@ def list(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -242,7 +238,7 @@ def list(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ScanResults", pipeline_response) + deserialized = self._deserialize("ScanResults", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_scans_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_scans_operations.py index 34710802a38a..97f0556cb8d4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_scans_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2020_07_01_preview/operations/_sql_vulnerability_assessment_scans_operations.py @@ -18,15 +18,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -155,7 +153,6 @@ def get(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -169,7 +166,7 @@ def get(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Scan", pipeline_response) + deserialized = self._deserialize("Scan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -213,7 +210,6 @@ def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.Sc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -227,7 +223,7 @@ def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.Sc map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Scans", pipeline_response) + deserialized = self._deserialize("Scans", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_metadata.json index cb3dcc820e6a..49ae432245b0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_security_center.py index d46d33468df9..9698b41c0ef4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -101,7 +102,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SecurityCenter": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_vendor.py +++ /dev/null @@ -1,16 +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 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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/_security_center.py index 3f7048750a26..8d09c67336c8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -103,7 +104,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SecurityCenter": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/operations/_alerts_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/operations/_alerts_operations.py index 7e0d2a752904..4eb1164c5db6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/operations/_alerts_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/aio/operations/_alerts_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._alerts_operations import ( build_get_resource_group_level_request, build_get_subscription_level_request, @@ -107,7 +107,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -123,7 +122,6 @@ def prepare_request(next_link=None): _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 @@ -187,7 +185,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -203,7 +200,6 @@ def prepare_request(next_link=None): _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 @@ -268,7 +264,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -284,7 +279,6 @@ def prepare_request(next_link=None): _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 @@ -355,7 +349,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -371,7 +364,6 @@ def prepare_request(next_link=None): _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 @@ -435,7 +427,6 @@ async def get_subscription_level(self, asc_location: str, alert_name: str, **kwa headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -449,7 +440,7 @@ async def get_subscription_level(self, asc_location: str, alert_name: str, **kwa map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Alert", pipeline_response) + deserialized = self._deserialize("Alert", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -497,7 +488,6 @@ async def get_resource_group_level( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -511,7 +501,7 @@ async def get_resource_group_level( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Alert", pipeline_response) + deserialized = self._deserialize("Alert", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -555,7 +545,6 @@ async def update_subscription_level_state_to_dismiss( # pylint: disable=inconsi headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -609,7 +598,6 @@ async def update_subscription_level_state_to_resolve( # pylint: disable=inconsi headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -663,7 +651,6 @@ async def update_subscription_level_state_to_activate( # pylint: disable=incons headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -721,7 +708,6 @@ async def update_resource_group_level_state_to_resolve( # pylint: disable=incon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -779,7 +765,6 @@ async def update_resource_group_level_state_to_dismiss( # pylint: disable=incon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -837,7 +822,6 @@ async def update_resource_group_level_state_to_activate( # pylint: disable=inco headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -854,12 +838,12 @@ async def update_resource_group_level_state_to_activate( # pylint: disable=inco if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _simulate_initial( # pylint: disable=inconsistent-return-statements + async def _simulate_initial( self, asc_location: str, alert_simulator_request_body: Union[_models.AlertSimulatorRequestBody, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -873,7 +857,7 @@ async def _simulate_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -893,10 +877,10 @@ async def _simulate_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -904,11 +888,19 @@ async def _simulate_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_simulate( @@ -989,7 +981,7 @@ async def begin_simulate( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._simulate_initial( # type: ignore + raw_result = await self._simulate_initial( asc_location=asc_location, alert_simulator_request_body=alert_simulator_request_body, api_version=api_version, @@ -999,6 +991,7 @@ async def begin_simulate( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/operations/_alerts_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/operations/_alerts_operations.py index 7dc8b0914b0f..bbe7e421d47d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/operations/_alerts_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_01_01/operations/_alerts_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,6 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -528,7 +528,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -544,7 +543,6 @@ def prepare_request(next_link=None): _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 @@ -608,7 +606,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -624,7 +621,6 @@ def prepare_request(next_link=None): _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 @@ -689,7 +685,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -705,7 +700,6 @@ def prepare_request(next_link=None): _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 @@ -776,7 +770,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -792,7 +785,6 @@ def prepare_request(next_link=None): _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 @@ -856,7 +848,6 @@ def get_subscription_level(self, asc_location: str, alert_name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -870,7 +861,7 @@ def get_subscription_level(self, asc_location: str, alert_name: str, **kwargs: A map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Alert", pipeline_response) + deserialized = self._deserialize("Alert", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -918,7 +909,6 @@ def get_resource_group_level( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -932,7 +922,7 @@ def get_resource_group_level( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Alert", pipeline_response) + deserialized = self._deserialize("Alert", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -976,7 +966,6 @@ def update_subscription_level_state_to_dismiss( # pylint: disable=inconsistent- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1030,7 +1019,6 @@ def update_subscription_level_state_to_resolve( # pylint: disable=inconsistent- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1084,7 +1072,6 @@ def update_subscription_level_state_to_activate( # pylint: disable=inconsistent headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1142,7 +1129,6 @@ def update_resource_group_level_state_to_resolve( # pylint: disable=inconsisten headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1200,7 +1186,6 @@ def update_resource_group_level_state_to_dismiss( # pylint: disable=inconsisten headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1258,7 +1243,6 @@ def update_resource_group_level_state_to_activate( # pylint: disable=inconsiste headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1275,12 +1259,12 @@ def update_resource_group_level_state_to_activate( # pylint: disable=inconsiste if cls: return cls(pipeline_response, None, {}) # type: ignore - def _simulate_initial( # pylint: disable=inconsistent-return-statements + def _simulate_initial( self, asc_location: str, alert_simulator_request_body: Union[_models.AlertSimulatorRequestBody, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1294,7 +1278,7 @@ def _simulate_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2021-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1314,10 +1298,10 @@ def _simulate_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1325,11 +1309,19 @@ def _simulate_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_simulate( @@ -1410,7 +1402,7 @@ def begin_simulate( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._simulate_initial( # type: ignore + raw_result = self._simulate_initial( asc_location=asc_location, alert_simulator_request_body=alert_simulator_request_body, api_version=api_version, @@ -1420,6 +1412,7 @@ def begin_simulate( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_metadata.json index d8f3e3285aa9..1523a4a5a7a9 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_security_center.py index 971b1c79f469..837b633db2c7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -102,7 +103,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SecurityCenter": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_vendor.py +++ /dev/null @@ -1,16 +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 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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/_security_center.py index 2fe63aadac3e..2965374eaa87 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -104,7 +105,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SecurityCenter": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/operations/_software_inventories_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/operations/_software_inventories_operations.py index 917e598a3b90..3a4db5f60d95 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/operations/_software_inventories_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/aio/operations/_software_inventories_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._software_inventories_operations import ( build_get_request, build_list_by_extended_resource_request, @@ -112,7 +110,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -128,7 +125,6 @@ def prepare_request(next_link=None): _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 @@ -191,7 +187,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -207,7 +202,6 @@ def prepare_request(next_link=None): _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 @@ -290,7 +284,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -304,7 +297,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Software", pipeline_response) + deserialized = self._deserialize("Software", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/operations/_software_inventories_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/operations/_software_inventories_operations.py index 042b29c7b9b2..2cb627e2096c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/operations/_software_inventories_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_05_01_preview/operations/_software_inventories_operations.py @@ -20,15 +20,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -223,7 +221,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -239,7 +236,6 @@ def prepare_request(next_link=None): _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 @@ -301,7 +297,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -317,7 +312,6 @@ def prepare_request(next_link=None): _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 @@ -400,7 +394,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -414,7 +407,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Software", pipeline_response) + deserialized = self._deserialize("Software", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_metadata.json index 8495601e58bf..c75b368d466f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_security_center.py index f445b685a441..02f365c36480 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -110,7 +111,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SecurityCenter": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_vendor.py +++ /dev/null @@ -1,16 +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 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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/_security_center.py index d97c4848a330..b41e4b2ab1da 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -112,7 +113,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SecurityCenter": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_assessments_metadata_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_assessments_metadata_operations.py index 76a58cee59f1..38d5b508d35f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_assessments_metadata_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_assessments_metadata_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._assessments_metadata_operations import ( build_create_in_subscription_request, build_delete_in_subscription_request, @@ -99,7 +97,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -115,7 +112,6 @@ def prepare_request(next_link=None): _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 @@ -175,7 +171,6 @@ async def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.Sec headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -189,7 +184,7 @@ async def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.Sec map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityAssessmentMetadataResponse", pipeline_response) + deserialized = self._deserialize("SecurityAssessmentMetadataResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -229,7 +224,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -245,7 +239,6 @@ def prepare_request(next_link=None): _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 @@ -308,7 +301,6 @@ async def get_in_subscription( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -322,7 +314,7 @@ async def get_in_subscription( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityAssessmentMetadataResponse", pipeline_response) + deserialized = self._deserialize("SecurityAssessmentMetadataResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -431,7 +423,6 @@ async def create_in_subscription( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -445,7 +436,7 @@ async def create_in_subscription( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityAssessmentMetadataResponse", pipeline_response) + deserialized = self._deserialize("SecurityAssessmentMetadataResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -487,7 +478,6 @@ async def delete_in_subscription( # pylint: disable=inconsistent-return-stateme headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_assessments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_assessments_operations.py index c05862b7833e..e0380634f471 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_assessments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_assessments_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._assessments_operations import ( build_create_or_update_request, build_delete_request, @@ -102,7 +100,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -118,7 +115,6 @@ def prepare_request(next_link=None): _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 @@ -190,7 +186,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -204,7 +199,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityAssessmentResponse", pipeline_response) + deserialized = self._deserialize("SecurityAssessmentResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -320,7 +315,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -334,11 +328,7 @@ async def create_or_update( 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("SecurityAssessmentResponse", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SecurityAssessmentResponse", pipeline_response) + deserialized = self._deserialize("SecurityAssessmentResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -381,7 +371,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_settings_operations.py index 41b3420fc012..e1f951e69f93 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/aio/operations/_settings_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._settings_operations import build_get_request, build_list_request, build_update_request if sys.version_info >= (3, 9): @@ -92,7 +90,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -108,7 +105,6 @@ def prepare_request(next_link=None): _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 @@ -169,7 +165,6 @@ async def get(self, setting_name: Union[str, _models.Enum12], **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -183,7 +178,7 @@ async def get(self, setting_name: Union[str, _models.Enum12], **kwargs: Any) -> map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Setting", pipeline_response) + deserialized = self._deserialize("Setting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -286,7 +281,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -300,7 +294,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Setting", pipeline_response) + deserialized = self._deserialize("Setting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_assessments_metadata_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_assessments_metadata_operations.py index a4fd60e46363..b018f5e6c05b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_assessments_metadata_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_assessments_metadata_operations.py @@ -21,15 +21,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -262,7 +260,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -278,7 +275,6 @@ def prepare_request(next_link=None): _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 @@ -338,7 +334,6 @@ def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.SecurityA headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -352,7 +347,7 @@ def get(self, assessment_metadata_name: str, **kwargs: Any) -> _models.SecurityA map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityAssessmentMetadataResponse", pipeline_response) + deserialized = self._deserialize("SecurityAssessmentMetadataResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -392,7 +387,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -408,7 +402,6 @@ def prepare_request(next_link=None): _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 @@ -471,7 +464,6 @@ def get_in_subscription( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -485,7 +477,7 @@ def get_in_subscription( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityAssessmentMetadataResponse", pipeline_response) + deserialized = self._deserialize("SecurityAssessmentMetadataResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -594,7 +586,6 @@ def create_in_subscription( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -608,7 +599,7 @@ def create_in_subscription( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityAssessmentMetadataResponse", pipeline_response) + deserialized = self._deserialize("SecurityAssessmentMetadataResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -650,7 +641,6 @@ def delete_in_subscription( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_assessments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_assessments_operations.py index 2b6a70b4088f..b7e7052f73d8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_assessments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_assessments_operations.py @@ -21,15 +21,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -205,7 +203,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -221,7 +218,6 @@ def prepare_request(next_link=None): _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 @@ -293,7 +289,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -307,7 +302,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityAssessmentResponse", pipeline_response) + deserialized = self._deserialize("SecurityAssessmentResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -423,7 +418,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -437,11 +431,7 @@ def create_or_update( 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("SecurityAssessmentResponse", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SecurityAssessmentResponse", pipeline_response) + deserialized = self._deserialize("SecurityAssessmentResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -484,7 +474,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_settings_operations.py index d2ee78a8476b..d268c12f8972 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_06_01/operations/_settings_operations.py @@ -21,15 +21,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -180,7 +178,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -196,7 +193,6 @@ def prepare_request(next_link=None): _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 @@ -257,7 +253,6 @@ def get(self, setting_name: Union[str, _models.Enum12], **kwargs: Any) -> _model headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -271,7 +266,7 @@ def get(self, setting_name: Union[str, _models.Enum12], **kwargs: Any) -> _model map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Setting", pipeline_response) + deserialized = self._deserialize("Setting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -374,7 +369,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -388,7 +382,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Setting", pipeline_response) + deserialized = self._deserialize("Setting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_metadata.json index 9fae64cfa56e..a4945a9e112f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_security_center.py index 84fcfd293b5f..cd8a0b9381a5 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -99,7 +100,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SecurityCenter": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_vendor.py +++ /dev/null @@ -1,16 +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 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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/_security_center.py index b64146988157..eb35b4a9ef2d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -101,7 +102,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SecurityCenter": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/operations/_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/operations/_settings_operations.py index 191310fe2d70..e828d84c5a0e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/operations/_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/aio/operations/_settings_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._settings_operations import build_get_request, build_list_request, build_update_request if sys.version_info >= (3, 9): @@ -92,7 +90,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -108,7 +105,6 @@ def prepare_request(next_link=None): _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 @@ -169,7 +165,6 @@ async def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -183,7 +178,7 @@ async def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Setting", pipeline_response) + deserialized = self._deserialize("Setting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -286,7 +281,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -300,7 +294,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Setting", pipeline_response) + deserialized = self._deserialize("Setting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/operations/_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/operations/_settings_operations.py index ff8d799d2b7e..65e1d503ecfb 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/operations/_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01/operations/_settings_operations.py @@ -21,15 +21,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -184,7 +182,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -200,7 +197,6 @@ def prepare_request(next_link=None): _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 @@ -261,7 +257,6 @@ def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any) -> _ headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -275,7 +270,7 @@ def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any) -> _ map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Setting", pipeline_response) + deserialized = self._deserialize("Setting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -378,7 +373,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -392,7 +386,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Setting", pipeline_response) + deserialized = self._deserialize("Setting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_metadata.json index 32943b42b47c..0cfb70d76fe8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -105,8 +105,6 @@ "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { - "custom_assessment_automations": "CustomAssessmentAutomationsOperations", - "custom_entity_store_assignments": "CustomEntityStoreAssignmentsOperations", "security_connectors": "SecurityConnectorsOperations" } } diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_security_center.py index 313d87834dd0..3a142fe0cab6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -17,11 +18,7 @@ from . import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration -from .operations import ( - CustomAssessmentAutomationsOperations, - CustomEntityStoreAssignmentsOperations, - SecurityConnectorsOperations, -) +from .operations import SecurityConnectorsOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -31,12 +28,6 @@ class SecurityCenter: # pylint: disable=client-accepts-api-version-keyword """API spec for Microsoft.Security (Azure Security Center) resource provider. - :ivar custom_assessment_automations: CustomAssessmentAutomationsOperations operations - :vartype custom_assessment_automations: - azure.mgmt.security.v2021_07_01_preview.operations.CustomAssessmentAutomationsOperations - :ivar custom_entity_store_assignments: CustomEntityStoreAssignmentsOperations operations - :vartype custom_entity_store_assignments: - azure.mgmt.security.v2021_07_01_preview.operations.CustomEntityStoreAssignmentsOperations :ivar security_connectors: SecurityConnectorsOperations operations :vartype security_connectors: azure.mgmt.security.v2021_07_01_preview.operations.SecurityConnectorsOperations @@ -83,12 +74,6 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.custom_assessment_automations = CustomAssessmentAutomationsOperations( - self._client, self._config, self._serialize, self._deserialize, "2021-07-01-preview" - ) - self.custom_entity_store_assignments = CustomEntityStoreAssignmentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2021-07-01-preview" - ) self.security_connectors = SecurityConnectorsOperations( self._client, self._config, self._serialize, self._deserialize, "2021-07-01-preview" ) @@ -118,7 +103,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SecurityCenter": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_vendor.py +++ /dev/null @@ -1,16 +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 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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/_security_center.py index cf27d5c0fe80..65f89d566a2b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,11 +18,7 @@ from .. import models as _models from ..._serialization import Deserializer, Serializer from ._configuration import SecurityCenterConfiguration -from .operations import ( - CustomAssessmentAutomationsOperations, - CustomEntityStoreAssignmentsOperations, - SecurityConnectorsOperations, -) +from .operations import SecurityConnectorsOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -31,12 +28,6 @@ class SecurityCenter: # pylint: disable=client-accepts-api-version-keyword """API spec for Microsoft.Security (Azure Security Center) resource provider. - :ivar custom_assessment_automations: CustomAssessmentAutomationsOperations operations - :vartype custom_assessment_automations: - azure.mgmt.security.v2021_07_01_preview.aio.operations.CustomAssessmentAutomationsOperations - :ivar custom_entity_store_assignments: CustomEntityStoreAssignmentsOperations operations - :vartype custom_entity_store_assignments: - azure.mgmt.security.v2021_07_01_preview.aio.operations.CustomEntityStoreAssignmentsOperations :ivar security_connectors: SecurityConnectorsOperations operations :vartype security_connectors: azure.mgmt.security.v2021_07_01_preview.aio.operations.SecurityConnectorsOperations @@ -83,12 +74,6 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.custom_assessment_automations = CustomAssessmentAutomationsOperations( - self._client, self._config, self._serialize, self._deserialize, "2021-07-01-preview" - ) - self.custom_entity_store_assignments = CustomEntityStoreAssignmentsOperations( - self._client, self._config, self._serialize, self._deserialize, "2021-07-01-preview" - ) self.security_connectors = SecurityConnectorsOperations( self._client, self._config, self._serialize, self._deserialize, "2021-07-01-preview" ) @@ -120,7 +105,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SecurityCenter": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/__init__.py index 395581c73e89..8e4ac6c4f04e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/__init__.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._custom_assessment_automations_operations import CustomAssessmentAutomationsOperations -from ._custom_entity_store_assignments_operations import CustomEntityStoreAssignmentsOperations from ._security_connectors_operations import SecurityConnectorsOperations from ._patch import __all__ as _patch_all @@ -15,8 +13,6 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "CustomAssessmentAutomationsOperations", - "CustomEntityStoreAssignmentsOperations", "SecurityConnectorsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_custom_assessment_automations_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_custom_assessment_automations_operations.py deleted file mode 100644 index 65a42b6b65ce..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_custom_assessment_automations_operations.py +++ /dev/null @@ -1,506 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, 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._custom_assessment_automations_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CustomAssessmentAutomationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.security.v2021_07_01_preview.aio.SecurityCenter`'s - :attr:`custom_assessment_automations` 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") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace_async - async def get( - self, resource_group_name: str, custom_assessment_automation_name: str, **kwargs: Any - ) -> _models.CustomAssessmentAutomation: - """Gets a custom assessment automation. - - Gets a single custom assessment automation by name for the provided subscription and resource - group. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param custom_assessment_automation_name: Name of the Custom Assessment Automation. Required. - :type custom_assessment_automation_name: str - :return: CustomAssessmentAutomation or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_07_01_preview.models.CustomAssessmentAutomation - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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", self._api_version or "2021-07-01-preview") - ) - cls: ClsType[_models.CustomAssessmentAutomation] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - custom_assessment_automation_name=custom_assessment_automation_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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("CustomAssessmentAutomation", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create( - self, - resource_group_name: str, - custom_assessment_automation_name: str, - custom_assessment_automation_body: _models.CustomAssessmentAutomationRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CustomAssessmentAutomation: - """Creates a custom assessment automation. - - Creates or updates a custom assessment automation for the provided subscription. Please note - that providing an existing custom assessment automation will replace the existing record. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param custom_assessment_automation_name: Name of the Custom Assessment Automation. Required. - :type custom_assessment_automation_name: str - :param custom_assessment_automation_body: Custom Assessment Automation body. Required. - :type custom_assessment_automation_body: - ~azure.mgmt.security.v2021_07_01_preview.models.CustomAssessmentAutomationRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomAssessmentAutomation or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_07_01_preview.models.CustomAssessmentAutomation - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, - resource_group_name: str, - custom_assessment_automation_name: str, - custom_assessment_automation_body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CustomAssessmentAutomation: - """Creates a custom assessment automation. - - Creates or updates a custom assessment automation for the provided subscription. Please note - that providing an existing custom assessment automation will replace the existing record. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param custom_assessment_automation_name: Name of the Custom Assessment Automation. Required. - :type custom_assessment_automation_name: str - :param custom_assessment_automation_body: Custom Assessment Automation body. Required. - :type custom_assessment_automation_body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomAssessmentAutomation or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_07_01_preview.models.CustomAssessmentAutomation - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, - resource_group_name: str, - custom_assessment_automation_name: str, - custom_assessment_automation_body: Union[_models.CustomAssessmentAutomationRequest, IO[bytes]], - **kwargs: Any - ) -> _models.CustomAssessmentAutomation: - """Creates a custom assessment automation. - - Creates or updates a custom assessment automation for the provided subscription. Please note - that providing an existing custom assessment automation will replace the existing record. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param custom_assessment_automation_name: Name of the Custom Assessment Automation. Required. - :type custom_assessment_automation_name: str - :param custom_assessment_automation_body: Custom Assessment Automation body. Is either a - CustomAssessmentAutomationRequest type or a IO[bytes] type. Required. - :type custom_assessment_automation_body: - ~azure.mgmt.security.v2021_07_01_preview.models.CustomAssessmentAutomationRequest or IO[bytes] - :return: CustomAssessmentAutomation or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_07_01_preview.models.CustomAssessmentAutomation - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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", self._api_version or "2021-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomAssessmentAutomation] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(custom_assessment_automation_body, (IOBase, bytes)): - _content = custom_assessment_automation_body - else: - _json = self._serialize.body(custom_assessment_automation_body, "CustomAssessmentAutomationRequest") - - _request = build_create_request( - resource_group_name=resource_group_name, - custom_assessment_automation_name=custom_assessment_automation_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - 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, 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("CustomAssessmentAutomation", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("CustomAssessmentAutomation", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, custom_assessment_automation_name: str, **kwargs: Any - ) -> None: - """Deletes a custom assessment automation. - - Deletes a custom assessment automation by name for a provided subscription. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param custom_assessment_automation_name: Name of the Custom Assessment Automation. Required. - :type custom_assessment_automation_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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", self._api_version or "2021-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - custom_assessment_automation_name=custom_assessment_automation_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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, {}) # type: ignore - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CustomAssessmentAutomation"]: - """List custom assessment automations in a subscription and a resource group. - - List custom assessment automations by provided subscription and resource group. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :return: An iterator like instance of either CustomAssessmentAutomation or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.security.v2021_07_01_preview.models.CustomAssessmentAutomation] - :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", self._api_version or "2021-07-01-preview") - ) - cls: ClsType[_models.CustomAssessmentAutomationsListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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._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("CustomAssessmentAutomationsListResult", 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) - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.CustomAssessmentAutomation"]: - """List custom assessment automations in a subscription. - - List custom assessment automations by provided subscription. - - :return: An iterator like instance of either CustomAssessmentAutomation or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.security.v2021_07_01_preview.models.CustomAssessmentAutomation] - :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", self._api_version or "2021-07-01-preview") - ) - cls: ClsType[_models.CustomAssessmentAutomationsListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - 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._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("CustomAssessmentAutomationsListResult", 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) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_custom_entity_store_assignments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_custom_entity_store_assignments_operations.py deleted file mode 100644 index ed2422d86fef..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_custom_entity_store_assignments_operations.py +++ /dev/null @@ -1,512 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, 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._custom_entity_store_assignments_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CustomEntityStoreAssignmentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.security.v2021_07_01_preview.aio.SecurityCenter`'s - :attr:`custom_entity_store_assignments` 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") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace_async - async def get( - self, resource_group_name: str, custom_entity_store_assignment_name: str, **kwargs: Any - ) -> _models.CustomEntityStoreAssignment: - """Gets a custom entity store assignment. - - Gets a single custom entity store assignment by name for the provided subscription and resource - group. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param custom_entity_store_assignment_name: Name of the custom entity store assignment. - Generated name is GUID. Required. - :type custom_entity_store_assignment_name: str - :return: CustomEntityStoreAssignment or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_07_01_preview.models.CustomEntityStoreAssignment - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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", self._api_version or "2021-07-01-preview") - ) - cls: ClsType[_models.CustomEntityStoreAssignment] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - custom_entity_store_assignment_name=custom_entity_store_assignment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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("CustomEntityStoreAssignment", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create( - self, - resource_group_name: str, - custom_entity_store_assignment_name: str, - custom_entity_store_assignment_request_body: _models.CustomEntityStoreAssignmentRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CustomEntityStoreAssignment: - """Creates a custom entity store assignment. - - Creates a custom entity store assignment for the provided subscription, if not already exists. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param custom_entity_store_assignment_name: Name of the custom entity store assignment. - Generated name is GUID. Required. - :type custom_entity_store_assignment_name: str - :param custom_entity_store_assignment_request_body: Custom entity store assignment body. - Required. - :type custom_entity_store_assignment_request_body: - ~azure.mgmt.security.v2021_07_01_preview.models.CustomEntityStoreAssignmentRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomEntityStoreAssignment or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_07_01_preview.models.CustomEntityStoreAssignment - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, - resource_group_name: str, - custom_entity_store_assignment_name: str, - custom_entity_store_assignment_request_body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CustomEntityStoreAssignment: - """Creates a custom entity store assignment. - - Creates a custom entity store assignment for the provided subscription, if not already exists. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param custom_entity_store_assignment_name: Name of the custom entity store assignment. - Generated name is GUID. Required. - :type custom_entity_store_assignment_name: str - :param custom_entity_store_assignment_request_body: Custom entity store assignment body. - Required. - :type custom_entity_store_assignment_request_body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomEntityStoreAssignment or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_07_01_preview.models.CustomEntityStoreAssignment - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, - resource_group_name: str, - custom_entity_store_assignment_name: str, - custom_entity_store_assignment_request_body: Union[_models.CustomEntityStoreAssignmentRequest, IO[bytes]], - **kwargs: Any - ) -> _models.CustomEntityStoreAssignment: - """Creates a custom entity store assignment. - - Creates a custom entity store assignment for the provided subscription, if not already exists. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param custom_entity_store_assignment_name: Name of the custom entity store assignment. - Generated name is GUID. Required. - :type custom_entity_store_assignment_name: str - :param custom_entity_store_assignment_request_body: Custom entity store assignment body. Is - either a CustomEntityStoreAssignmentRequest type or a IO[bytes] type. Required. - :type custom_entity_store_assignment_request_body: - ~azure.mgmt.security.v2021_07_01_preview.models.CustomEntityStoreAssignmentRequest or IO[bytes] - :return: CustomEntityStoreAssignment or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_07_01_preview.models.CustomEntityStoreAssignment - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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", self._api_version or "2021-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomEntityStoreAssignment] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(custom_entity_store_assignment_request_body, (IOBase, bytes)): - _content = custom_entity_store_assignment_request_body - else: - _json = self._serialize.body( - custom_entity_store_assignment_request_body, "CustomEntityStoreAssignmentRequest" - ) - - _request = build_create_request( - resource_group_name=resource_group_name, - custom_entity_store_assignment_name=custom_entity_store_assignment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - 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, 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("CustomEntityStoreAssignment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("CustomEntityStoreAssignment", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, custom_entity_store_assignment_name: str, **kwargs: Any - ) -> None: - """Deleted a custom entity store assignment. - - Delete a custom entity store assignment by name for a provided subscription. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param custom_entity_store_assignment_name: Name of the custom entity store assignment. - Generated name is GUID. Required. - :type custom_entity_store_assignment_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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", self._api_version or "2021-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - custom_entity_store_assignment_name=custom_entity_store_assignment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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, {}) # type: ignore - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.CustomEntityStoreAssignment"]: - """List custom entity store assignments in a subscription and a resource group. - - List custom entity store assignments by a provided subscription and resource group. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :return: An iterator like instance of either CustomEntityStoreAssignment or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.security.v2021_07_01_preview.models.CustomEntityStoreAssignment] - :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", self._api_version or "2021-07-01-preview") - ) - cls: ClsType[_models.CustomEntityStoreAssignmentsListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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._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("CustomEntityStoreAssignmentsListResult", 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) - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.CustomEntityStoreAssignment"]: - """List custom entity store assignments in a subscription. - - List custom entity store assignments by provided subscription. - - :return: An iterator like instance of either CustomEntityStoreAssignment or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.security.v2021_07_01_preview.models.CustomEntityStoreAssignment] - :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", self._api_version or "2021-07-01-preview") - ) - cls: ClsType[_models.CustomEntityStoreAssignmentsListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - 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._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("CustomEntityStoreAssignmentsListResult", 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) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_security_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_security_connectors_operations.py index 2c3c6fcb6562..88baf38ad0ee 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_security_connectors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/aio/operations/_security_connectors_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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_connectors_operations import ( build_create_or_update_request, build_delete_request, @@ -102,7 +100,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -118,7 +115,6 @@ def prepare_request(next_link=None): _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 @@ -188,7 +184,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -204,7 +199,6 @@ def prepare_request(next_link=None): _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 @@ -272,7 +266,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -286,7 +279,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityConnector", pipeline_response) + deserialized = self._deserialize("SecurityConnector", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -409,7 +402,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -423,11 +415,7 @@ async def create_or_update( 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("SecurityConnector", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SecurityConnector", pipeline_response) + deserialized = self._deserialize("SecurityConnector", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -547,7 +535,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -561,7 +548,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityConnector", pipeline_response) + deserialized = self._deserialize("SecurityConnector", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -607,7 +594,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/models/__init__.py index 4e9aeed6ee6e..ed1352ee29ea 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/models/__init__.py @@ -11,12 +11,6 @@ from ._models_py3 import CloudOffering from ._models_py3 import CspmMonitorAwsOffering from ._models_py3 import CspmMonitorAwsOfferingNativeCloudConnection -from ._models_py3 import CustomAssessmentAutomation -from ._models_py3 import CustomAssessmentAutomationRequest -from ._models_py3 import CustomAssessmentAutomationsListResult -from ._models_py3 import CustomEntityStoreAssignment -from ._models_py3 import CustomEntityStoreAssignmentRequest -from ._models_py3 import CustomEntityStoreAssignmentsListResult from ._models_py3 import DefenderForContainersAwsOffering from ._models_py3 import DefenderForContainersAwsOfferingCloudWatchToKinesis from ._models_py3 import DefenderForContainersAwsOfferingKinesisToS3 @@ -43,8 +37,6 @@ from ._security_center_enums import CreatedByType from ._security_center_enums import OfferingType from ._security_center_enums import OrganizationMembershipType -from ._security_center_enums import SeverityEnum -from ._security_center_enums import SupportedCloudEnum from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk @@ -55,12 +47,6 @@ "CloudOffering", "CspmMonitorAwsOffering", "CspmMonitorAwsOfferingNativeCloudConnection", - "CustomAssessmentAutomation", - "CustomAssessmentAutomationRequest", - "CustomAssessmentAutomationsListResult", - "CustomEntityStoreAssignment", - "CustomEntityStoreAssignmentRequest", - "CustomEntityStoreAssignmentsListResult", "DefenderForContainersAwsOffering", "DefenderForContainersAwsOfferingCloudWatchToKinesis", "DefenderForContainersAwsOfferingKinesisToS3", @@ -86,8 +72,6 @@ "CreatedByType", "OfferingType", "OrganizationMembershipType", - "SeverityEnum", - "SupportedCloudEnum", ] __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_07_01_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/models/_models_py3.py index 9928221fb257..0eb934785c1a 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/models/_models_py3.py @@ -194,373 +194,6 @@ def __init__(self, *, cloud_role_arn: Optional[str] = None, **kwargs: Any) -> No self.cloud_role_arn = cloud_role_arn -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 CustomAssessmentAutomation(Resource): # pylint: disable=too-many-instance-attributes - """Custom Assessment Automation. - - 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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.security.v2021_07_01_preview.models.SystemData - :ivar compressed_query: GZip encoded KQL query representing the assessment automation results - required. - :vartype compressed_query: str - :ivar supported_cloud: Relevant cloud for the custom assessment automation. Known values are: - "AWS" and "GCP". - :vartype supported_cloud: str or - ~azure.mgmt.security.v2021_07_01_preview.models.SupportedCloudEnum - :ivar severity: The severity to relate to the assessments generated by this assessment - automation. Known values are: "High", "Medium", and "Low". - :vartype severity: str or ~azure.mgmt.security.v2021_07_01_preview.models.SeverityEnum - :ivar display_name: The display name of the assessments generated by this assessment - automation. - :vartype display_name: str - :ivar description: The description to relate to the assessments generated by this assessment - automation. - :vartype description: str - :ivar remediation_description: The remediation description to relate to the assessments - generated by this assessment automation. - :vartype remediation_description: str - :ivar assessment_key: The assessment metadata key used when an assessment is generated for this - assessment automation. - :vartype assessment_key: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"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"}, - "compressed_query": {"key": "properties.compressedQuery", "type": "str"}, - "supported_cloud": {"key": "properties.supportedCloud", "type": "str"}, - "severity": {"key": "properties.severity", "type": "str"}, - "display_name": {"key": "properties.displayName", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "remediation_description": {"key": "properties.remediationDescription", "type": "str"}, - "assessment_key": {"key": "properties.assessmentKey", "type": "str"}, - } - - def __init__( - self, - *, - compressed_query: Optional[str] = None, - supported_cloud: Union[str, "_models.SupportedCloudEnum"] = "AWS", - severity: Union[str, "_models.SeverityEnum"] = "Low", - display_name: Optional[str] = None, - description: Optional[str] = None, - remediation_description: Optional[str] = None, - assessment_key: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword compressed_query: GZip encoded KQL query representing the assessment automation - results required. - :paramtype compressed_query: str - :keyword supported_cloud: Relevant cloud for the custom assessment automation. Known values - are: "AWS" and "GCP". - :paramtype supported_cloud: str or - ~azure.mgmt.security.v2021_07_01_preview.models.SupportedCloudEnum - :keyword severity: The severity to relate to the assessments generated by this assessment - automation. Known values are: "High", "Medium", and "Low". - :paramtype severity: str or ~azure.mgmt.security.v2021_07_01_preview.models.SeverityEnum - :keyword display_name: The display name of the assessments generated by this assessment - automation. - :paramtype display_name: str - :keyword description: The description to relate to the assessments generated by this assessment - automation. - :paramtype description: str - :keyword remediation_description: The remediation description to relate to the assessments - generated by this assessment automation. - :paramtype remediation_description: str - :keyword assessment_key: The assessment metadata key used when an assessment is generated for - this assessment automation. - :paramtype assessment_key: str - """ - super().__init__(**kwargs) - self.system_data = None - self.compressed_query = compressed_query - self.supported_cloud = supported_cloud - self.severity = severity - self.display_name = display_name - self.description = description - self.remediation_description = remediation_description - self.assessment_key = assessment_key - - -class CustomAssessmentAutomationRequest(Resource): - """Custom Assessment Automation request. - - 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 compressed_query: Base 64 encoded KQL query representing the assessment automation - results required. - :vartype compressed_query: str - :ivar supported_cloud: Relevant cloud for the custom assessment automation. Known values are: - "AWS" and "GCP". - :vartype supported_cloud: str or - ~azure.mgmt.security.v2021_07_01_preview.models.SupportedCloudEnum - :ivar severity: The severity to relate to the assessments generated by this assessment - automation. Known values are: "High", "Medium", and "Low". - :vartype severity: str or ~azure.mgmt.security.v2021_07_01_preview.models.SeverityEnum - :ivar display_name: The display name of the assessments generated by this assessment - automation. - :vartype display_name: str - :ivar description: The description to relate to the assessments generated by this assessment - automation. - :vartype description: str - :ivar remediation_description: The remediation description to relate to the assessments - generated by this assessment automation. - :vartype remediation_description: 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"}, - "compressed_query": {"key": "properties.compressedQuery", "type": "str"}, - "supported_cloud": {"key": "properties.supportedCloud", "type": "str"}, - "severity": {"key": "properties.severity", "type": "str"}, - "display_name": {"key": "properties.displayName", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "remediation_description": {"key": "properties.remediationDescription", "type": "str"}, - } - - def __init__( - self, - *, - compressed_query: Optional[str] = None, - supported_cloud: Union[str, "_models.SupportedCloudEnum"] = "AWS", - severity: Union[str, "_models.SeverityEnum"] = "Low", - display_name: Optional[str] = None, - description: Optional[str] = None, - remediation_description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword compressed_query: Base 64 encoded KQL query representing the assessment automation - results required. - :paramtype compressed_query: str - :keyword supported_cloud: Relevant cloud for the custom assessment automation. Known values - are: "AWS" and "GCP". - :paramtype supported_cloud: str or - ~azure.mgmt.security.v2021_07_01_preview.models.SupportedCloudEnum - :keyword severity: The severity to relate to the assessments generated by this assessment - automation. Known values are: "High", "Medium", and "Low". - :paramtype severity: str or ~azure.mgmt.security.v2021_07_01_preview.models.SeverityEnum - :keyword display_name: The display name of the assessments generated by this assessment - automation. - :paramtype display_name: str - :keyword description: The description to relate to the assessments generated by this assessment - automation. - :paramtype description: str - :keyword remediation_description: The remediation description to relate to the assessments - generated by this assessment automation. - :paramtype remediation_description: str - """ - super().__init__(**kwargs) - self.compressed_query = compressed_query - self.supported_cloud = supported_cloud - self.severity = severity - self.display_name = display_name - self.description = description - self.remediation_description = remediation_description - - -class CustomAssessmentAutomationsListResult(_serialization.Model): - """A list of Custom Assessment Automations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Collection of Custom Assessment Automations. - :vartype value: - list[~azure.mgmt.security.v2021_07_01_preview.models.CustomAssessmentAutomation] - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[CustomAssessmentAutomation]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = None - self.next_link = next_link - - -class CustomEntityStoreAssignment(Resource): - """Custom entity store assignment. - - 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 system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.security.v2021_07_01_preview.models.SystemData - :ivar principal: The principal assigned with entity store. Format of principal is: [AAD - type]=[PrincipalObjectId];[TenantId]. - :vartype principal: str - :ivar entity_store_database_link: The link to entity store database. - :vartype entity_store_database_link: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"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"}, - "principal": {"key": "properties.principal", "type": "str"}, - "entity_store_database_link": {"key": "properties.entityStoreDatabaseLink", "type": "str"}, - } - - def __init__( - self, *, principal: Optional[str] = None, entity_store_database_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword principal: The principal assigned with entity store. Format of principal is: [AAD - type]=[PrincipalObjectId];[TenantId]. - :paramtype principal: str - :keyword entity_store_database_link: The link to entity store database. - :paramtype entity_store_database_link: str - """ - super().__init__(**kwargs) - self.system_data = None - self.principal = principal - self.entity_store_database_link = entity_store_database_link - - -class CustomEntityStoreAssignmentRequest(_serialization.Model): - """describes the custom entity store assignment request. - - :ivar principal: The principal assigned with entity store. If not provided, will use caller - principal. Format of principal is: [AAD type]=[PrincipalObjectId];[TenantId]. - :vartype principal: str - """ - - _attribute_map = { - "principal": {"key": "properties.principal", "type": "str"}, - } - - def __init__(self, *, principal: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword principal: The principal assigned with entity store. If not provided, will use caller - principal. Format of principal is: [AAD type]=[PrincipalObjectId];[TenantId]. - :paramtype principal: str - """ - super().__init__(**kwargs) - self.principal = principal - - -class CustomEntityStoreAssignmentsListResult(_serialization.Model): - """A list of custom entity store assignments. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Collection of custom entity store assignments. - :vartype value: - list[~azure.mgmt.security.v2021_07_01_preview.models.CustomEntityStoreAssignment] - :ivar next_link: The link used to get the next page of operations. - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[CustomEntityStoreAssignment]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword next_link: The link used to get the next page of operations. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = None - self.next_link = next_link - - class DefenderForContainersAwsOffering(CloudOffering): """The Defender for Containers AWS offering configurations. @@ -1019,6 +652,39 @@ def __init__(self, *, kind: Optional[str] = None, **kwargs: Any) -> None: self.kind = kind +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 Tags(_serialization.Model): """A list of key value pairs that describe the resource. diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/models/_security_center_enums.py index 719ba9a6bf61..90418bcfd06c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/models/_security_center_enums.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/models/_security_center_enums.py @@ -41,18 +41,3 @@ class OrganizationMembershipType(str, Enum, metaclass=CaseInsensitiveEnumMeta): MEMBER = "Member" ORGANIZATION = "Organization" - - -class SeverityEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The severity to relate to the assessments generated by this assessment automation.""" - - HIGH = "High" - MEDIUM = "Medium" - LOW = "Low" - - -class SupportedCloudEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Relevant cloud for the custom assessment automation.""" - - AWS = "AWS" - GCP = "GCP" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/__init__.py index 395581c73e89..8e4ac6c4f04e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/__init__.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._custom_assessment_automations_operations import CustomAssessmentAutomationsOperations -from ._custom_entity_store_assignments_operations import CustomEntityStoreAssignmentsOperations from ._security_connectors_operations import SecurityConnectorsOperations from ._patch import __all__ as _patch_all @@ -15,8 +13,6 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "CustomAssessmentAutomationsOperations", - "CustomEntityStoreAssignmentsOperations", "SecurityConnectorsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_custom_assessment_automations_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_custom_assessment_automations_operations.py deleted file mode 100644 index 995c032e7e21..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_custom_assessment_automations_operations.py +++ /dev/null @@ -1,676 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, 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 - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, custom_assessment_automation_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-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}", - ) # 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}$" - ), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "customAssessmentAutomationName": _SERIALIZER.url( - "custom_assessment_automation_name", custom_assessment_automation_name, "str" - ), - } - - _url: str = _url.format(**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( - resource_group_name: str, custom_assessment_automation_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-07-01-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}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}", - ) # 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}$" - ), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "customAssessmentAutomationName": _SERIALIZER.url( - "custom_assessment_automation_name", custom_assessment_automation_name, "str" - ), - } - - _url: str = _url.format(**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( - resource_group_name: str, custom_assessment_automation_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-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}", - ) # 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}$" - ), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "customAssessmentAutomationName": _SERIALIZER.url( - "custom_assessment_automation_name", custom_assessment_automation_name, "str" - ), - } - - _url: str = _url.format(**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_by_resource_group_request(resource_group_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-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations", - ) # 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}$" - ), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - } - - _url: str = _url.format(**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_list_by_subscription_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-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Security/customAssessmentAutomations" - ) # 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}$" - ), - } - - _url: str = _url.format(**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) - - -class CustomAssessmentAutomationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.security.v2021_07_01_preview.SecurityCenter`'s - :attr:`custom_assessment_automations` 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") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def get( - self, resource_group_name: str, custom_assessment_automation_name: str, **kwargs: Any - ) -> _models.CustomAssessmentAutomation: - """Gets a custom assessment automation. - - Gets a single custom assessment automation by name for the provided subscription and resource - group. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param custom_assessment_automation_name: Name of the Custom Assessment Automation. Required. - :type custom_assessment_automation_name: str - :return: CustomAssessmentAutomation or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_07_01_preview.models.CustomAssessmentAutomation - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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", self._api_version or "2021-07-01-preview") - ) - cls: ClsType[_models.CustomAssessmentAutomation] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - custom_assessment_automation_name=custom_assessment_automation_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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("CustomAssessmentAutomation", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create( - self, - resource_group_name: str, - custom_assessment_automation_name: str, - custom_assessment_automation_body: _models.CustomAssessmentAutomationRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CustomAssessmentAutomation: - """Creates a custom assessment automation. - - Creates or updates a custom assessment automation for the provided subscription. Please note - that providing an existing custom assessment automation will replace the existing record. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param custom_assessment_automation_name: Name of the Custom Assessment Automation. Required. - :type custom_assessment_automation_name: str - :param custom_assessment_automation_body: Custom Assessment Automation body. Required. - :type custom_assessment_automation_body: - ~azure.mgmt.security.v2021_07_01_preview.models.CustomAssessmentAutomationRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomAssessmentAutomation or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_07_01_preview.models.CustomAssessmentAutomation - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - resource_group_name: str, - custom_assessment_automation_name: str, - custom_assessment_automation_body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CustomAssessmentAutomation: - """Creates a custom assessment automation. - - Creates or updates a custom assessment automation for the provided subscription. Please note - that providing an existing custom assessment automation will replace the existing record. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param custom_assessment_automation_name: Name of the Custom Assessment Automation. Required. - :type custom_assessment_automation_name: str - :param custom_assessment_automation_body: Custom Assessment Automation body. Required. - :type custom_assessment_automation_body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomAssessmentAutomation or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_07_01_preview.models.CustomAssessmentAutomation - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, - resource_group_name: str, - custom_assessment_automation_name: str, - custom_assessment_automation_body: Union[_models.CustomAssessmentAutomationRequest, IO[bytes]], - **kwargs: Any - ) -> _models.CustomAssessmentAutomation: - """Creates a custom assessment automation. - - Creates or updates a custom assessment automation for the provided subscription. Please note - that providing an existing custom assessment automation will replace the existing record. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param custom_assessment_automation_name: Name of the Custom Assessment Automation. Required. - :type custom_assessment_automation_name: str - :param custom_assessment_automation_body: Custom Assessment Automation body. Is either a - CustomAssessmentAutomationRequest type or a IO[bytes] type. Required. - :type custom_assessment_automation_body: - ~azure.mgmt.security.v2021_07_01_preview.models.CustomAssessmentAutomationRequest or IO[bytes] - :return: CustomAssessmentAutomation or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_07_01_preview.models.CustomAssessmentAutomation - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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", self._api_version or "2021-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomAssessmentAutomation] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(custom_assessment_automation_body, (IOBase, bytes)): - _content = custom_assessment_automation_body - else: - _json = self._serialize.body(custom_assessment_automation_body, "CustomAssessmentAutomationRequest") - - _request = build_create_request( - resource_group_name=resource_group_name, - custom_assessment_automation_name=custom_assessment_automation_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - 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, 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("CustomAssessmentAutomation", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("CustomAssessmentAutomation", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, custom_assessment_automation_name: str, **kwargs: Any - ) -> None: - """Deletes a custom assessment automation. - - Deletes a custom assessment automation by name for a provided subscription. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param custom_assessment_automation_name: Name of the Custom Assessment Automation. Required. - :type custom_assessment_automation_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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", self._api_version or "2021-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - custom_assessment_automation_name=custom_assessment_automation_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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, {}) # type: ignore - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.CustomAssessmentAutomation"]: - """List custom assessment automations in a subscription and a resource group. - - List custom assessment automations by provided subscription and resource group. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :return: An iterator like instance of either CustomAssessmentAutomation or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.security.v2021_07_01_preview.models.CustomAssessmentAutomation] - :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", self._api_version or "2021-07-01-preview") - ) - cls: ClsType[_models.CustomAssessmentAutomationsListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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._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("CustomAssessmentAutomationsListResult", 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) - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.CustomAssessmentAutomation"]: - """List custom assessment automations in a subscription. - - List custom assessment automations by provided subscription. - - :return: An iterator like instance of either CustomAssessmentAutomation or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.security.v2021_07_01_preview.models.CustomAssessmentAutomation] - :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", self._api_version or "2021-07-01-preview") - ) - cls: ClsType[_models.CustomAssessmentAutomationsListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - 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._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("CustomAssessmentAutomationsListResult", 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) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_custom_entity_store_assignments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_custom_entity_store_assignments_operations.py deleted file mode 100644 index 90da419c0abf..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_custom_entity_store_assignments_operations.py +++ /dev/null @@ -1,682 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, 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 - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, custom_entity_store_assignment_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-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}", - ) # 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}$" - ), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "customEntityStoreAssignmentName": _SERIALIZER.url( - "custom_entity_store_assignment_name", custom_entity_store_assignment_name, "str" - ), - } - - _url: str = _url.format(**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( - resource_group_name: str, custom_entity_store_assignment_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-07-01-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}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}", - ) # 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}$" - ), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "customEntityStoreAssignmentName": _SERIALIZER.url( - "custom_entity_store_assignment_name", custom_entity_store_assignment_name, "str" - ), - } - - _url: str = _url.format(**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( - resource_group_name: str, custom_entity_store_assignment_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-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}", - ) # 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}$" - ), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - "customEntityStoreAssignmentName": _SERIALIZER.url( - "custom_entity_store_assignment_name", custom_entity_store_assignment_name, "str" - ), - } - - _url: str = _url.format(**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_by_resource_group_request(resource_group_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-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments", - ) # 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}$" - ), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" - ), - } - - _url: str = _url.format(**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_list_by_subscription_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-07-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Security/customEntityStoreAssignments" - ) # 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}$" - ), - } - - _url: str = _url.format(**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) - - -class CustomEntityStoreAssignmentsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.security.v2021_07_01_preview.SecurityCenter`'s - :attr:`custom_entity_store_assignments` 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") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def get( - self, resource_group_name: str, custom_entity_store_assignment_name: str, **kwargs: Any - ) -> _models.CustomEntityStoreAssignment: - """Gets a custom entity store assignment. - - Gets a single custom entity store assignment by name for the provided subscription and resource - group. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param custom_entity_store_assignment_name: Name of the custom entity store assignment. - Generated name is GUID. Required. - :type custom_entity_store_assignment_name: str - :return: CustomEntityStoreAssignment or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_07_01_preview.models.CustomEntityStoreAssignment - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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", self._api_version or "2021-07-01-preview") - ) - cls: ClsType[_models.CustomEntityStoreAssignment] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - custom_entity_store_assignment_name=custom_entity_store_assignment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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("CustomEntityStoreAssignment", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create( - self, - resource_group_name: str, - custom_entity_store_assignment_name: str, - custom_entity_store_assignment_request_body: _models.CustomEntityStoreAssignmentRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CustomEntityStoreAssignment: - """Creates a custom entity store assignment. - - Creates a custom entity store assignment for the provided subscription, if not already exists. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param custom_entity_store_assignment_name: Name of the custom entity store assignment. - Generated name is GUID. Required. - :type custom_entity_store_assignment_name: str - :param custom_entity_store_assignment_request_body: Custom entity store assignment body. - Required. - :type custom_entity_store_assignment_request_body: - ~azure.mgmt.security.v2021_07_01_preview.models.CustomEntityStoreAssignmentRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomEntityStoreAssignment or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_07_01_preview.models.CustomEntityStoreAssignment - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - resource_group_name: str, - custom_entity_store_assignment_name: str, - custom_entity_store_assignment_request_body: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.CustomEntityStoreAssignment: - """Creates a custom entity store assignment. - - Creates a custom entity store assignment for the provided subscription, if not already exists. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param custom_entity_store_assignment_name: Name of the custom entity store assignment. - Generated name is GUID. Required. - :type custom_entity_store_assignment_name: str - :param custom_entity_store_assignment_request_body: Custom entity store assignment body. - Required. - :type custom_entity_store_assignment_request_body: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CustomEntityStoreAssignment or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_07_01_preview.models.CustomEntityStoreAssignment - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, - resource_group_name: str, - custom_entity_store_assignment_name: str, - custom_entity_store_assignment_request_body: Union[_models.CustomEntityStoreAssignmentRequest, IO[bytes]], - **kwargs: Any - ) -> _models.CustomEntityStoreAssignment: - """Creates a custom entity store assignment. - - Creates a custom entity store assignment for the provided subscription, if not already exists. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param custom_entity_store_assignment_name: Name of the custom entity store assignment. - Generated name is GUID. Required. - :type custom_entity_store_assignment_name: str - :param custom_entity_store_assignment_request_body: Custom entity store assignment body. Is - either a CustomEntityStoreAssignmentRequest type or a IO[bytes] type. Required. - :type custom_entity_store_assignment_request_body: - ~azure.mgmt.security.v2021_07_01_preview.models.CustomEntityStoreAssignmentRequest or IO[bytes] - :return: CustomEntityStoreAssignment or the result of cls(response) - :rtype: ~azure.mgmt.security.v2021_07_01_preview.models.CustomEntityStoreAssignment - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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", self._api_version or "2021-07-01-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CustomEntityStoreAssignment] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(custom_entity_store_assignment_request_body, (IOBase, bytes)): - _content = custom_entity_store_assignment_request_body - else: - _json = self._serialize.body( - custom_entity_store_assignment_request_body, "CustomEntityStoreAssignmentRequest" - ) - - _request = build_create_request( - resource_group_name=resource_group_name, - custom_entity_store_assignment_name=custom_entity_store_assignment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - 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, 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("CustomEntityStoreAssignment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("CustomEntityStoreAssignment", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, custom_entity_store_assignment_name: str, **kwargs: Any - ) -> None: - """Deleted a custom entity store assignment. - - Delete a custom entity store assignment by name for a provided subscription. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :param custom_entity_store_assignment_name: Name of the custom entity store assignment. - Generated name is GUID. Required. - :type custom_entity_store_assignment_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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", self._api_version or "2021-07-01-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - custom_entity_store_assignment_name=custom_entity_store_assignment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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, {}) # type: ignore - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> Iterable["_models.CustomEntityStoreAssignment"]: - """List custom entity store assignments in a subscription and a resource group. - - List custom entity store assignments by a provided subscription and resource group. - - :param resource_group_name: The name of the resource group within the user's subscription. The - name is case insensitive. Required. - :type resource_group_name: str - :return: An iterator like instance of either CustomEntityStoreAssignment or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.security.v2021_07_01_preview.models.CustomEntityStoreAssignment] - :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", self._api_version or "2021-07-01-preview") - ) - cls: ClsType[_models.CustomEntityStoreAssignmentsListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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._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("CustomEntityStoreAssignmentsListResult", 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) - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.CustomEntityStoreAssignment"]: - """List custom entity store assignments in a subscription. - - List custom entity store assignments by provided subscription. - - :return: An iterator like instance of either CustomEntityStoreAssignment or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.security.v2021_07_01_preview.models.CustomEntityStoreAssignment] - :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", self._api_version or "2021-07-01-preview") - ) - cls: ClsType[_models.CustomEntityStoreAssignmentsListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 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_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - 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._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("CustomEntityStoreAssignmentsListResult", 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) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_security_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_security_connectors_operations.py index 8fac3ac7ec6b..f494a8e69f7f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_security_connectors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_07_01_preview/operations/_security_connectors_operations.py @@ -21,15 +21,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -301,7 +299,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -317,7 +314,6 @@ def prepare_request(next_link=None): _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 @@ -385,7 +381,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -401,7 +396,6 @@ def prepare_request(next_link=None): _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 @@ -467,7 +461,6 @@ def get(self, resource_group_name: str, security_connector_name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -481,7 +474,7 @@ def get(self, resource_group_name: str, security_connector_name: str, **kwargs: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityConnector", pipeline_response) + deserialized = self._deserialize("SecurityConnector", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -604,7 +597,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -618,11 +610,7 @@ def create_or_update( 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("SecurityConnector", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SecurityConnector", pipeline_response) + deserialized = self._deserialize("SecurityConnector", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -742,7 +730,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -756,7 +743,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityConnector", pipeline_response) + deserialized = self._deserialize("SecurityConnector", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -802,7 +789,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_metadata.json index 7c3feadf2ff7..7da289b153b3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_security_center.py index e118d1ed94d8..470f2e059379 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -102,7 +103,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SecurityCenter": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_vendor.py +++ /dev/null @@ -1,16 +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 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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/_security_center.py index fe44a1bc0bcd..7437b3b699dd 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -104,7 +105,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SecurityCenter": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/operations/_mde_onboardings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/operations/_mde_onboardings_operations.py index 925ea8904d06..7ce5e1e22958 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/operations/_mde_onboardings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/aio/operations/_mde_onboardings_operations.py @@ -18,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 -from ..._vendor import _convert_request from ...operations._mde_onboardings_operations import build_get_request, build_list_request if sys.version_info >= (3, 9): @@ -86,7 +84,6 @@ async def list(self, **kwargs: Any) -> _models.MdeOnboardingDataList: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -100,7 +97,7 @@ async def list(self, **kwargs: Any) -> _models.MdeOnboardingDataList: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("MdeOnboardingDataList", pipeline_response) + deserialized = self._deserialize("MdeOnboardingDataList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -137,7 +134,6 @@ async def get(self, **kwargs: Any) -> _models.MdeOnboardingData: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -151,7 +147,7 @@ async def get(self, **kwargs: Any) -> _models.MdeOnboardingData: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("MdeOnboardingData", pipeline_response) + deserialized = self._deserialize("MdeOnboardingData", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/operations/_mde_onboardings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/operations/_mde_onboardings_operations.py index 637018bde336..8b5e1b17185c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/operations/_mde_onboardings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2021_10_01_preview/operations/_mde_onboardings_operations.py @@ -18,15 +18,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -143,7 +141,6 @@ def list(self, **kwargs: Any) -> _models.MdeOnboardingDataList: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -157,7 +154,7 @@ def list(self, **kwargs: Any) -> _models.MdeOnboardingDataList: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("MdeOnboardingDataList", pipeline_response) + deserialized = self._deserialize("MdeOnboardingDataList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -194,7 +191,6 @@ def get(self, **kwargs: Any) -> _models.MdeOnboardingData: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -208,7 +204,7 @@ def get(self, **kwargs: Any) -> _models.MdeOnboardingData: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("MdeOnboardingData", pipeline_response) + deserialized = self._deserialize("MdeOnboardingData", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_metadata.json index 2d7855bd872f..cdba5a729b40 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_security_center.py index d2e0152b6d78..930ead0f069b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -101,7 +102,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SecurityCenter": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_vendor.py +++ /dev/null @@ -1,16 +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 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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/_security_center.py index edb93f68b5f8..d901d67c6632 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -103,7 +104,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SecurityCenter": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/operations/_alerts_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/operations/_alerts_operations.py index 2be62b2e3250..87b52e2d8862 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/operations/_alerts_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/aio/operations/_alerts_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._alerts_operations import ( build_get_resource_group_level_request, build_get_subscription_level_request, @@ -109,7 +109,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -125,7 +124,6 @@ def prepare_request(next_link=None): _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 @@ -189,7 +187,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -205,7 +202,6 @@ def prepare_request(next_link=None): _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 @@ -270,7 +266,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -286,7 +281,6 @@ def prepare_request(next_link=None): _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 @@ -357,7 +351,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -373,7 +366,6 @@ def prepare_request(next_link=None): _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 @@ -437,7 +429,6 @@ async def get_subscription_level(self, asc_location: str, alert_name: str, **kwa headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -451,7 +442,7 @@ async def get_subscription_level(self, asc_location: str, alert_name: str, **kwa map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Alert", pipeline_response) + deserialized = self._deserialize("Alert", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -499,7 +490,6 @@ async def get_resource_group_level( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -513,7 +503,7 @@ async def get_resource_group_level( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Alert", pipeline_response) + deserialized = self._deserialize("Alert", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -557,7 +547,6 @@ async def update_subscription_level_state_to_dismiss( # pylint: disable=inconsi headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -611,7 +600,6 @@ async def update_subscription_level_state_to_resolve( # pylint: disable=inconsi headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -665,7 +653,6 @@ async def update_subscription_level_state_to_activate( # pylint: disable=incons headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -719,7 +706,6 @@ async def update_subscription_level_state_to_in_progress( # pylint: disable=inc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -777,7 +763,6 @@ async def update_resource_group_level_state_to_resolve( # pylint: disable=incon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -835,7 +820,6 @@ async def update_resource_group_level_state_to_dismiss( # pylint: disable=incon headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -893,7 +877,6 @@ async def update_resource_group_level_state_to_activate( # pylint: disable=inco headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -951,7 +934,6 @@ async def update_resource_group_level_state_to_in_progress( # pylint: disable=i headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -968,12 +950,12 @@ async def update_resource_group_level_state_to_in_progress( # pylint: disable=i if cls: return cls(pipeline_response, None, {}) # type: ignore - async def _simulate_initial( # pylint: disable=inconsistent-return-statements + async def _simulate_initial( self, asc_location: str, alert_simulator_request_body: Union[_models.AlertSimulatorRequestBody, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -987,7 +969,7 @@ async def _simulate_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1007,10 +989,10 @@ async def _simulate_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1018,11 +1000,19 @@ async def _simulate_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload async def begin_simulate( @@ -1103,7 +1093,7 @@ async def begin_simulate( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._simulate_initial( # type: ignore + raw_result = await self._simulate_initial( asc_location=asc_location, alert_simulator_request_body=alert_simulator_request_body, api_version=api_version, @@ -1113,6 +1103,7 @@ async def begin_simulate( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/operations/_alerts_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/operations/_alerts_operations.py index 4df5342b1e4d..d415d0257025 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/operations/_alerts_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01/operations/_alerts_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,6 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -597,7 +597,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -613,7 +612,6 @@ def prepare_request(next_link=None): _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 @@ -677,7 +675,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -693,7 +690,6 @@ def prepare_request(next_link=None): _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 @@ -758,7 +754,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -774,7 +769,6 @@ def prepare_request(next_link=None): _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 @@ -845,7 +839,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -861,7 +854,6 @@ def prepare_request(next_link=None): _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 @@ -925,7 +917,6 @@ def get_subscription_level(self, asc_location: str, alert_name: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -939,7 +930,7 @@ def get_subscription_level(self, asc_location: str, alert_name: str, **kwargs: A map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Alert", pipeline_response) + deserialized = self._deserialize("Alert", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -987,7 +978,6 @@ def get_resource_group_level( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1001,7 +991,7 @@ def get_resource_group_level( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Alert", pipeline_response) + deserialized = self._deserialize("Alert", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1045,7 +1035,6 @@ def update_subscription_level_state_to_dismiss( # pylint: disable=inconsistent- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1099,7 +1088,6 @@ def update_subscription_level_state_to_resolve( # pylint: disable=inconsistent- headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1153,7 +1141,6 @@ def update_subscription_level_state_to_activate( # pylint: disable=inconsistent headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1207,7 +1194,6 @@ def update_subscription_level_state_to_in_progress( # pylint: disable=inconsist headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1265,7 +1251,6 @@ def update_resource_group_level_state_to_resolve( # pylint: disable=inconsisten headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1323,7 +1308,6 @@ def update_resource_group_level_state_to_dismiss( # pylint: disable=inconsisten headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1381,7 +1365,6 @@ def update_resource_group_level_state_to_activate( # pylint: disable=inconsiste headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1439,7 +1422,6 @@ def update_resource_group_level_state_to_in_progress( # pylint: disable=inconsi headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1456,12 +1438,12 @@ def update_resource_group_level_state_to_in_progress( # pylint: disable=inconsi if cls: return cls(pipeline_response, None, {}) # type: ignore - def _simulate_initial( # pylint: disable=inconsistent-return-statements + def _simulate_initial( self, asc_location: str, alert_simulator_request_body: Union[_models.AlertSimulatorRequestBody, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1475,7 +1457,7 @@ def _simulate_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2022-01-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1495,10 +1477,10 @@ def _simulate_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -1506,11 +1488,19 @@ def _simulate_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @overload def begin_simulate( @@ -1591,7 +1581,7 @@ def begin_simulate( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._simulate_initial( # type: ignore + raw_result = self._simulate_initial( asc_location=asc_location, alert_simulator_request_body=alert_simulator_request_body, api_version=api_version, @@ -1601,6 +1591,7 @@ def begin_simulate( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_metadata.json index 59ceb6374562..8c8f18f88dd0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_security_center.py index 8a7fe54ca5c5..7a52ba4d1f0f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -104,7 +105,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SecurityCenter": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_vendor.py +++ /dev/null @@ -1,16 +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 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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/_security_center.py index 9bc01cdb0fb6..27b122e8818f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -106,7 +107,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SecurityCenter": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_assignments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_assignments_operations.py index 8f5e1fb3f5f2..fc5cb572e36e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_assignments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_assignments_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._governance_assignments_operations import ( build_create_or_update_request, build_delete_request, @@ -108,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -124,7 +121,6 @@ def prepare_request(next_link=None): _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 @@ -197,7 +193,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -211,7 +206,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("GovernanceAssignment", pipeline_response) + deserialized = self._deserialize("GovernanceAssignment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -350,7 +345,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -364,11 +358,7 @@ async def create_or_update( 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("GovernanceAssignment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("GovernanceAssignment", pipeline_response) + deserialized = self._deserialize("GovernanceAssignment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -419,7 +409,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_rules_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_rules_operations.py index 9c4b330c7b30..4dba71bbc222 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_rules_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/aio/operations/_governance_rules_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._governance_rules_operations import ( build_create_or_update_request, build_delete_request, @@ -109,7 +109,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -125,7 +124,6 @@ def prepare_request(next_link=None): _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 @@ -194,7 +192,6 @@ async def get(self, scope: str, rule_id: str, **kwargs: Any) -> _models.Governan headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -208,7 +205,7 @@ async def get(self, scope: str, rule_id: str, **kwargs: Any) -> _models.Governan map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("GovernanceRule", pipeline_response) + deserialized = self._deserialize("GovernanceRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -335,7 +332,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -349,20 +345,14 @@ async def create_or_update( 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("GovernanceRule", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("GovernanceRule", pipeline_response) + deserialized = self._deserialize("GovernanceRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, scope: str, rule_id: str, **kwargs: Any - ) -> None: + async def _delete_initial(self, scope: str, rule_id: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -377,7 +367,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop( "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") ) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( scope=scope, @@ -386,10 +376,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -397,6 +387,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -404,8 +398,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete(self, scope: str, rule_id: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -435,7 +433,7 @@ async def begin_delete(self, scope: str, rule_id: str, **kwargs: Any) -> AsyncLR lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( scope=scope, rule_id=rule_id, api_version=api_version, @@ -444,6 +442,7 @@ async def begin_delete(self, scope: str, rule_id: str, **kwargs: Any) -> AsyncLR params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -467,13 +466,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _execute_initial( # pylint: disable=inconsistent-return-statements + async def _execute_initial( self, scope: str, rule_id: str, execute_governance_rule_params: Optional[Union[_models.ExecuteGovernanceRuleParams, IO[bytes]]] = None, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -489,7 +488,7 @@ async def _execute_initial( # pylint: disable=inconsistent-return-statements "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -512,10 +511,10 @@ async def _execute_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -523,14 +522,22 @@ async def _execute_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload async def begin_execute( @@ -636,7 +643,7 @@ async def begin_execute( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._execute_initial( # type: ignore + raw_result = await self._execute_initial( scope=scope, rule_id=rule_id, execute_governance_rule_params=execute_governance_rule_params, @@ -647,6 +654,7 @@ async def begin_execute( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -716,7 +724,6 @@ async def operation_results( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -733,7 +740,7 @@ async def operation_results( deserialized = None response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("OperationResultAutoGenerated", pipeline_response) + deserialized = self._deserialize("OperationResultAutoGenerated", pipeline_response.http_response) if response.status_code == 202: response_headers["location"] = self._deserialize("str", response.headers.get("location")) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/models/_models_py3.py index f4f2f28269aa..fd5c97285506 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/models/_models_py3.py @@ -78,7 +78,7 @@ class Condition(_serialization.Model): see examples. :vartype value: str :ivar operator: The governance rule Condition's Operator, for example Equals for severity or In - for list of assessments, see examples. Known values are: "Equals" and "In". + for list of assessments, see examples. Known values are: "Equals", "In", and "In". :vartype operator: str or ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRuleConditionOperator """ @@ -105,7 +105,7 @@ def __init__( keys, see examples. :paramtype value: str :keyword operator: The governance rule Condition's Operator, for example Equals for severity or - In for list of assessments, see examples. Known values are: "Equals" and "In". + In for list of assessments, see examples. Known values are: "Equals", "In", and "In". :paramtype operator: str or ~azure.mgmt.security.v2022_01_01_preview.models.GovernanceRuleConditionOperator """ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/models/_security_center_enums.py index f3b5f33e2b11..2c9c79bb1aed 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/models/_security_center_enums.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/models/_security_center_enums.py @@ -17,6 +17,9 @@ class GovernanceRuleConditionOperator(str, Enum, metaclass=CaseInsensitiveEnumMe EQUALS = "Equals" """Checks that the string value of the data defined in Property equals the given value - exact fit""" + IN = "In" + """Checks that the string value of the data defined in Property equals any of the given values + (exact fit)""" IN_ENUM = "In" """Checks that the string value of the data defined in Property equals any of the given values (exact fit)""" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_assignments_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_assignments_operations.py index 1b845e3ecf33..589b27f7c9de 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_assignments_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_assignments_operations.py @@ -21,15 +21,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -216,7 +214,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -232,7 +229,6 @@ def prepare_request(next_link=None): _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 @@ -303,7 +299,6 @@ def get(self, scope: str, assessment_name: str, assignment_key: str, **kwargs: A headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -317,7 +312,7 @@ def get(self, scope: str, assessment_name: str, assignment_key: str, **kwargs: A map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("GovernanceAssignment", pipeline_response) + deserialized = self._deserialize("GovernanceAssignment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -456,7 +451,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -470,11 +464,7 @@ def create_or_update( 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("GovernanceAssignment", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("GovernanceAssignment", pipeline_response) + deserialized = self._deserialize("GovernanceAssignment", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -525,7 +515,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_rules_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_rules_operations.py index 7ba3858be5ad..e92ea200316b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_rules_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_01_01_preview/operations/_governance_rules_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,6 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -256,7 +256,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -272,7 +271,6 @@ def prepare_request(next_link=None): _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 @@ -341,7 +339,6 @@ def get(self, scope: str, rule_id: str, **kwargs: Any) -> _models.GovernanceRule headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -355,7 +352,7 @@ def get(self, scope: str, rule_id: str, **kwargs: Any) -> _models.GovernanceRule map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("GovernanceRule", pipeline_response) + deserialized = self._deserialize("GovernanceRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -482,7 +479,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -496,20 +492,14 @@ def create_or_update( 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("GovernanceRule", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("GovernanceRule", pipeline_response) + deserialized = self._deserialize("GovernanceRule", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, scope: str, rule_id: str, **kwargs: Any - ) -> None: + def _delete_initial(self, scope: str, rule_id: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -524,7 +514,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop( "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") ) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( scope=scope, @@ -533,10 +523,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -544,6 +534,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) @@ -551,8 +545,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if response.status_code == 202: response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, scope: str, rule_id: str, **kwargs: Any) -> LROPoller[None]: @@ -582,7 +580,7 @@ def begin_delete(self, scope: str, rule_id: str, **kwargs: Any) -> LROPoller[Non lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( scope=scope, rule_id=rule_id, api_version=api_version, @@ -591,6 +589,7 @@ def begin_delete(self, scope: str, rule_id: str, **kwargs: Any) -> LROPoller[Non params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -614,13 +613,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _execute_initial( # pylint: disable=inconsistent-return-statements + def _execute_initial( self, scope: str, rule_id: str, execute_governance_rule_params: Optional[Union[_models.ExecuteGovernanceRuleParams, IO[bytes]]] = None, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -636,7 +635,7 @@ def _execute_initial( # pylint: disable=inconsistent-return-statements "api_version", _params.pop("api-version", self._api_version or "2022-01-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -659,10 +658,10 @@ def _execute_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -670,14 +669,22 @@ def _execute_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) response_headers = {} response_headers["location"] = self._deserialize("str", response.headers.get("location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, response_headers) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @overload def begin_execute( @@ -783,7 +790,7 @@ def begin_execute( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._execute_initial( # type: ignore + raw_result = self._execute_initial( scope=scope, rule_id=rule_id, execute_governance_rule_params=execute_governance_rule_params, @@ -794,6 +801,7 @@ def begin_execute( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -863,7 +871,6 @@ def operation_results( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -880,7 +887,7 @@ def operation_results( deserialized = None response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("OperationResultAutoGenerated", pipeline_response) + deserialized = self._deserialize("OperationResultAutoGenerated", pipeline_response.http_response) if response.status_code == 202: response_headers["location"] = self._deserialize("str", response.headers.get("location")) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_metadata.json index 06641fba8d17..65a55471c892 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_security_center.py index 3fb86b37837f..430c6835e63e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -99,7 +100,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SecurityCenter": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_vendor.py +++ /dev/null @@ -1,16 +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 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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/_security_center.py index 09f0daec148a..4b60dc3aa021 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -101,7 +102,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SecurityCenter": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/operations/_pricings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/operations/_pricings_operations.py index 7fe672d518c6..829ae04455d4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/operations/_pricings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/aio/operations/_pricings_operations.py @@ -19,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 -from ..._vendor import _convert_request from ...operations._pricings_operations import build_get_request, build_list_request, build_update_request if sys.version_info >= (3, 9): @@ -85,7 +83,6 @@ async def list(self, **kwargs: Any) -> _models.PricingList: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -99,7 +96,7 @@ async def list(self, **kwargs: Any) -> _models.PricingList: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PricingList", pipeline_response) + deserialized = self._deserialize("PricingList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -137,7 +134,6 @@ async def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -151,7 +147,7 @@ async def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Pricing", pipeline_response) + deserialized = self._deserialize("Pricing", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -241,7 +237,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -255,7 +250,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Pricing", pipeline_response) + deserialized = self._deserialize("Pricing", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/operations/_pricings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/operations/_pricings_operations.py index 62221fd0c2ff..2d4cc860171f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/operations/_pricings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_03_01/operations/_pricings_operations.py @@ -19,15 +19,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -175,7 +173,6 @@ def list(self, **kwargs: Any) -> _models.PricingList: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -189,7 +186,7 @@ def list(self, **kwargs: Any) -> _models.PricingList: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PricingList", pipeline_response) + deserialized = self._deserialize("PricingList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -227,7 +224,6 @@ def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -241,7 +237,7 @@ def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Pricing", pipeline_response) + deserialized = self._deserialize("Pricing", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -329,7 +325,6 @@ def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO[bytes]], headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -343,7 +338,7 @@ def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO[bytes]], map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Pricing", pipeline_response) + deserialized = self._deserialize("Pricing", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_metadata.json index 000473759a5c..d0b5885e7409 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_security_center.py index 609dfa142dbf..6fe69490cb7c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -99,7 +100,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SecurityCenter": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_vendor.py +++ /dev/null @@ -1,16 +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 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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/_security_center.py index d010d839e1b8..89d2002249d8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -101,7 +102,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SecurityCenter": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/operations/_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/operations/_settings_operations.py index 3c4b0b2833e5..4d489b530dc4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/operations/_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/aio/operations/_settings_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._settings_operations import build_get_request, build_list_request, build_update_request if sys.version_info >= (3, 9): @@ -92,7 +90,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -108,7 +105,6 @@ def prepare_request(next_link=None): _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 @@ -169,7 +165,6 @@ async def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -183,7 +178,7 @@ async def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Setting", pipeline_response) + deserialized = self._deserialize("Setting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -286,7 +281,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -300,7 +294,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Setting", pipeline_response) + deserialized = self._deserialize("Setting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/operations/_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/operations/_settings_operations.py index b36aebecad2d..72f43c4fa88b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/operations/_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01/operations/_settings_operations.py @@ -21,15 +21,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -184,7 +182,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -200,7 +197,6 @@ def prepare_request(next_link=None): _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 @@ -261,7 +257,6 @@ def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any) -> _ headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -275,7 +270,7 @@ def get(self, setting_name: Union[str, _models.SettingName], **kwargs: Any) -> _ map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Setting", pipeline_response) + deserialized = self._deserialize("Setting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -378,7 +373,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -392,7 +386,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Setting", pipeline_response) + deserialized = self._deserialize("Setting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_metadata.json index 338c4a897367..c5cb0064a35e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_security_center.py index 040129d892f1..f5a8a711995b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -102,7 +103,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SecurityCenter": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_vendor.py +++ /dev/null @@ -1,16 +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 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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/_security_center.py index f475fc7e7c1e..9be5a9f17ed5 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -104,7 +105,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SecurityCenter": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/operations/_security_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/operations/_security_connectors_operations.py index 6fe1eca26c61..4b7a8722b9f1 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/operations/_security_connectors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/aio/operations/_security_connectors_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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_connectors_operations import ( build_create_or_update_request, build_delete_request, @@ -102,7 +100,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -118,7 +115,6 @@ def prepare_request(next_link=None): _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 @@ -188,7 +184,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -204,7 +199,6 @@ def prepare_request(next_link=None): _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 @@ -272,7 +266,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -286,7 +279,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityConnector", pipeline_response) + deserialized = self._deserialize("SecurityConnector", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -409,7 +402,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -423,11 +415,7 @@ async def create_or_update( 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("SecurityConnector", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SecurityConnector", pipeline_response) + deserialized = self._deserialize("SecurityConnector", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -547,7 +535,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -561,7 +548,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityConnector", pipeline_response) + deserialized = self._deserialize("SecurityConnector", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -607,7 +594,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/operations/_security_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/operations/_security_connectors_operations.py index bd0b234c0fd7..99fea7a4a2e8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/operations/_security_connectors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_05_01_preview/operations/_security_connectors_operations.py @@ -21,15 +21,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -301,7 +299,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -317,7 +314,6 @@ def prepare_request(next_link=None): _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 @@ -385,7 +381,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -401,7 +396,6 @@ def prepare_request(next_link=None): _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 @@ -467,7 +461,6 @@ def get(self, resource_group_name: str, security_connector_name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -481,7 +474,7 @@ def get(self, resource_group_name: str, security_connector_name: str, **kwargs: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityConnector", pipeline_response) + deserialized = self._deserialize("SecurityConnector", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -604,7 +597,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -618,11 +610,7 @@ def create_or_update( 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("SecurityConnector", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SecurityConnector", pipeline_response) + deserialized = self._deserialize("SecurityConnector", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -742,7 +730,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -756,7 +743,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityConnector", pipeline_response) + deserialized = self._deserialize("SecurityConnector", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -802,7 +789,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_metadata.json index 9029fc5833ab..e7d477bce13a 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_security_center.py index 435452d29273..664f6b3a82c6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -124,7 +125,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SecurityCenter": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_vendor.py +++ /dev/null @@ -1,16 +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 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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/_security_center.py index 8be4ada0d4ec..6f755550908d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -127,7 +128,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SecurityCenter": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_application_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_application_operations.py index c1aa54689f9b..6169f0e7bd62 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_application_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_application_operations.py @@ -19,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 -from ..._vendor import _convert_request from ...operations._application_operations import ( build_create_or_update_request, build_delete_request, @@ -95,7 +93,6 @@ async def get(self, application_id: str, **kwargs: Any) -> _models.Application: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -109,7 +106,7 @@ async def get(self, application_id: str, **kwargs: Any) -> _models.Application: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Application", pipeline_response) + deserialized = self._deserialize("Application", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -210,7 +207,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -224,11 +220,7 @@ async def create_or_update( 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("Application", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Application", pipeline_response) + deserialized = self._deserialize("Application", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -271,7 +263,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_applications_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_applications_operations.py index 80d2ef587e4f..d9d1c07db7cf 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_applications_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_applications_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 from ...operations._applications_operations import build_list_request if sys.version_info >= (3, 9): @@ -92,7 +90,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -108,7 +105,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_security_connector_application_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_security_connector_application_operations.py index 812daae52eab..5cf9991b5bb2 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_security_connector_application_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_security_connector_application_operations.py @@ -19,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 -from ..._vendor import _convert_request from ...operations._security_connector_application_operations import ( build_create_or_update_request, build_delete_request, @@ -104,7 +102,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -118,7 +115,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Application", pipeline_response) + deserialized = self._deserialize("Application", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -250,7 +247,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -264,11 +260,7 @@ async def create_or_update( 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("Application", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Application", pipeline_response) + deserialized = self._deserialize("Application", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -318,7 +310,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_security_connector_applications_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_security_connector_applications_operations.py index 2401b3eafdeb..21391b30fbf3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_security_connector_applications_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/aio/operations/_security_connector_applications_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 from ...operations._security_connector_applications_operations import build_list_request if sys.version_info >= (3, 9): @@ -101,7 +99,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -117,7 +114,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/_models_py3.py index 6f7d99436f2b..9a74a30a3ed6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/_models_py3.py @@ -131,7 +131,7 @@ class ApplicationCondition(_serialization.Model): :ivar value: The application Condition's Value like IDs that contain some string, see examples. :vartype value: str :ivar operator: The application Condition's Operator, for example Contains for id or In for - list of possible IDs, see examples. Known values are: "Contains", "Equals", and "In". + list of possible IDs, see examples. Known values are: "Contains", "Equals", "In", and "In". :vartype operator: str or ~azure.mgmt.security.v2022_07_01_preview.models.ApplicationConditionOperator """ @@ -157,7 +157,7 @@ def __init__( examples. :paramtype value: str :keyword operator: The application Condition's Operator, for example Contains for id or In for - list of possible IDs, see examples. Known values are: "Contains", "Equals", and "In". + list of possible IDs, see examples. Known values are: "Contains", "Equals", "In", and "In". :paramtype operator: str or ~azure.mgmt.security.v2022_07_01_preview.models.ApplicationConditionOperator """ diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/_security_center_enums.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/_security_center_enums.py index e49ee5a27f81..488804241fb7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/_security_center_enums.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/models/_security_center_enums.py @@ -19,6 +19,9 @@ class ApplicationConditionOperator(str, Enum, metaclass=CaseInsensitiveEnumMeta) """Checks that the string value of the data defined in Property contains the given value""" EQUALS = "Equals" """Checks that the string value of the data defined in Property equals the given value""" + IN = "In" + """Checks that the string value of the data defined in Property equals any of the given values + (exact fit)""" IN_ENUM = "In" """Checks that the string value of the data defined in Property equals any of the given values (exact fit)""" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_application_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_application_operations.py index 46beb9d6a936..be3b3f73029d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_application_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_application_operations.py @@ -19,15 +19,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -178,7 +176,6 @@ def get(self, application_id: str, **kwargs: Any) -> _models.Application: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -192,7 +189,7 @@ def get(self, application_id: str, **kwargs: Any) -> _models.Application: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Application", pipeline_response) + deserialized = self._deserialize("Application", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -293,7 +290,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -307,11 +303,7 @@ def create_or_update( 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("Application", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Application", pipeline_response) + deserialized = self._deserialize("Application", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -352,7 +344,6 @@ def delete(self, application_id: str, **kwargs: Any) -> None: # pylint: disable headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_applications_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_applications_operations.py index a33cd30cb99b..517716c49bc9 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_applications_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_applications_operations.py @@ -20,15 +20,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -121,7 +119,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -137,7 +134,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_security_connector_application_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_security_connector_application_operations.py index 2389279997ec..a7077e5c2550 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_security_connector_application_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_security_connector_application_operations.py @@ -19,15 +19,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -208,7 +206,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -222,7 +219,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Application", pipeline_response) + deserialized = self._deserialize("Application", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -354,7 +351,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -368,11 +364,7 @@ def create_or_update( 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("Application", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Application", pipeline_response) + deserialized = self._deserialize("Application", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -422,7 +414,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_security_connector_applications_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_security_connector_applications_operations.py index eb0daea47f9e..d2ac3d032f74 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_security_connector_applications_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_07_01_preview/operations/_security_connector_applications_operations.py @@ -20,15 +20,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -139,7 +137,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -155,7 +152,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_metadata.json index 08cb37743f99..e769958a3881 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_security_center.py index edbe7eb6c5ec..718cd988dd88 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -102,7 +103,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SecurityCenter": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_vendor.py +++ /dev/null @@ -1,16 +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 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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/_security_center.py index 9776df709cf0..bea12c4fa01b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -104,7 +105,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SecurityCenter": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/operations/_security_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/operations/_security_connectors_operations.py index badc76df4c7f..33cb4fa5c9e3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/operations/_security_connectors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/aio/operations/_security_connectors_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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_connectors_operations import ( build_create_or_update_request, build_delete_request, @@ -102,7 +100,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -118,7 +115,6 @@ def prepare_request(next_link=None): _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 @@ -188,7 +184,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -204,7 +199,6 @@ def prepare_request(next_link=None): _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 @@ -272,7 +266,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -286,7 +279,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityConnector", pipeline_response) + deserialized = self._deserialize("SecurityConnector", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -409,7 +402,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -423,11 +415,7 @@ async def create_or_update( 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("SecurityConnector", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SecurityConnector", pipeline_response) + deserialized = self._deserialize("SecurityConnector", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -547,7 +535,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -561,7 +548,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityConnector", pipeline_response) + deserialized = self._deserialize("SecurityConnector", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -607,7 +594,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/operations/_security_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/operations/_security_connectors_operations.py index dd673b59cbc5..4f5eaded8f3e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/operations/_security_connectors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_08_01_preview/operations/_security_connectors_operations.py @@ -21,15 +21,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -301,7 +299,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -317,7 +314,6 @@ def prepare_request(next_link=None): _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 @@ -385,7 +381,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -401,7 +396,6 @@ def prepare_request(next_link=None): _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 @@ -467,7 +461,6 @@ def get(self, resource_group_name: str, security_connector_name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -481,7 +474,7 @@ def get(self, resource_group_name: str, security_connector_name: str, **kwargs: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityConnector", pipeline_response) + deserialized = self._deserialize("SecurityConnector", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -604,7 +597,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -618,11 +610,7 @@ def create_or_update( 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("SecurityConnector", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SecurityConnector", pipeline_response) + deserialized = self._deserialize("SecurityConnector", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -742,7 +730,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -756,7 +743,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityConnector", pipeline_response) + deserialized = self._deserialize("SecurityConnector", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -802,7 +789,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/_metadata.json index 8297ec3c2498..28614a05f617 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/_security_center.py index e1bbc4543bde..427dafd01ad0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -114,7 +115,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SecurityCenter": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/_vendor.py +++ /dev/null @@ -1,16 +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 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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/aio/_security_center.py index 5a0a3a5d0262..3141def628f4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/aio/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -116,7 +117,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SecurityCenter": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/aio/operations/_api_collection_offboarding_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/aio/operations/_api_collection_offboarding_operations.py index bd55326d8846..eb89094aa243 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/aio/operations/_api_collection_offboarding_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/aio/operations/_api_collection_offboarding_operations.py @@ -18,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 -from ..._vendor import _convert_request from ...operations._api_collection_offboarding_operations import build_delete_request if sys.version_info >= (3, 9): @@ -103,7 +101,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/aio/operations/_api_collection_onboarding_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/aio/operations/_api_collection_onboarding_operations.py index f78729e071e0..2538bf357bc1 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/aio/operations/_api_collection_onboarding_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/aio/operations/_api_collection_onboarding_operations.py @@ -18,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 -from ..._vendor import _convert_request from ...operations._api_collection_onboarding_operations import build_create_request if sys.version_info >= (3, 9): @@ -104,7 +102,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -119,7 +116,7 @@ async def create( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiCollectionResponse", pipeline_response) + deserialized = self._deserialize("ApiCollectionResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/aio/operations/_api_collection_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/aio/operations/_api_collection_operations.py index 8cbe6fa71002..2d7d6287bb39 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/aio/operations/_api_collection_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/aio/operations/_api_collection_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._api_collection_operations import build_get_request, build_list_request if sys.version_info >= (3, 9): @@ -108,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -124,7 +121,6 @@ def prepare_request(next_link=None): _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 @@ -203,7 +199,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -218,7 +213,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiCollectionResponse", pipeline_response) + deserialized = self._deserialize("ApiCollectionResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/operations/_api_collection_offboarding_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/operations/_api_collection_offboarding_operations.py index 8bc3019b533c..f02b54f57d2b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/operations/_api_collection_offboarding_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/operations/_api_collection_offboarding_operations.py @@ -18,15 +18,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -147,7 +145,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/operations/_api_collection_onboarding_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/operations/_api_collection_onboarding_operations.py index bea1903c358d..ff9c0e472da3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/operations/_api_collection_onboarding_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/operations/_api_collection_onboarding_operations.py @@ -18,15 +18,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -148,7 +146,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -163,7 +160,7 @@ def create( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiCollectionResponse", pipeline_response) + deserialized = self._deserialize("ApiCollectionResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/operations/_api_collection_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/operations/_api_collection_operations.py index f26f8a6cf1cc..a7ff653739d1 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/operations/_api_collection_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_11_20_preview/operations/_api_collection_operations.py @@ -20,15 +20,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -189,7 +187,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -205,7 +202,6 @@ def prepare_request(next_link=None): _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 @@ -284,7 +280,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -299,7 +294,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiCollectionResponse", pipeline_response) + deserialized = self._deserialize("ApiCollectionResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_12_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_12_01_preview/_metadata.json index 23e59dd321b9..9d004e3b8227 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_12_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_12_01_preview/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_12_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_12_01_preview/_security_center.py index 8b2037fbdb75..e8a0fa66d9eb 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_12_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_12_01_preview/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -96,7 +97,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SecurityCenter": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_12_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_12_01_preview/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_12_01_preview/_vendor.py +++ /dev/null @@ -1,16 +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 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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_12_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_12_01_preview/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_12_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_12_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_12_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_12_01_preview/aio/_security_center.py index 14c01d5fe23f..4ea2fab3088b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_12_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_12_01_preview/aio/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -98,7 +99,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SecurityCenter": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_12_01_preview/aio/operations/_defender_for_storage_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_12_01_preview/aio/operations/_defender_for_storage_operations.py index 17929b22c132..2182ae5cd497 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_12_01_preview/aio/operations/_defender_for_storage_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_12_01_preview/aio/operations/_defender_for_storage_operations.py @@ -19,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 -from ..._vendor import _convert_request from ...operations._defender_for_storage_operations import build_create_request, build_get_request if sys.version_info >= (3, 9): @@ -94,7 +92,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -108,7 +105,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DefenderForStorageSetting", pipeline_response) + deserialized = self._deserialize("DefenderForStorageSetting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -225,7 +222,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -239,11 +235,7 @@ async def create( 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("DefenderForStorageSetting", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("DefenderForStorageSetting", pipeline_response) + deserialized = self._deserialize("DefenderForStorageSetting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_12_01_preview/models/__init__.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_12_01_preview/models/__init__.py index cdc4834354ce..dc73d6f6f0a9 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_12_01_preview/models/__init__.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_12_01_preview/models/__init__.py @@ -8,9 +8,13 @@ from ._models_py3 import CloudErrorBody from ._models_py3 import DefenderForStorageSetting +from ._models_py3 import DefenderForStorageSettingProperties from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import MalwareScanningProperties +from ._models_py3 import OnUploadProperties from ._models_py3 import OperationStatus from ._models_py3 import Resource +from ._models_py3 import SensitiveDataDiscoveryProperties from ._security_center_enums import SettingName from ._patch import __all__ as _patch_all @@ -20,9 +24,13 @@ __all__ = [ "CloudErrorBody", "DefenderForStorageSetting", + "DefenderForStorageSettingProperties", "ErrorAdditionalInfo", + "MalwareScanningProperties", + "OnUploadProperties", "OperationStatus", "Resource", + "SensitiveDataDiscoveryProperties", "SettingName", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_12_01_preview/models/_models_py3.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_12_01_preview/models/_models_py3.py index c7f7f0eb8723..919758de9cc9 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_12_01_preview/models/_models_py3.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_12_01_preview/models/_models_py3.py @@ -7,10 +7,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TYPE_CHECKING from ... import _serialization +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models + class CloudErrorBody(_serialization.Model): """The error detail. @@ -89,7 +93,7 @@ def __init__(self, **kwargs: Any) -> None: self.type = None -class DefenderForStorageSetting(Resource): # pylint: disable=too-many-instance-attributes +class DefenderForStorageSetting(Resource): """The Defender for Storage resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -100,115 +104,86 @@ class DefenderForStorageSetting(Resource): # pylint: disable=too-many-instance- :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar is_enabled_properties_is_enabled: Indicates whether Defender for Storage is enabled on - this storage account. - :vartype is_enabled_properties_is_enabled: bool - :ivar override_subscription_level_settings: Indicates whether the settings defined for this - storage account should override the settings defined for the subscription. - :vartype override_subscription_level_settings: bool - :ivar is_enabled_properties_sensitive_data_discovery_is_enabled: Indicates whether Sensitive - Data Discovery should be enabled. - :vartype is_enabled_properties_sensitive_data_discovery_is_enabled: bool - :ivar operation_status_properties_sensitive_data_discovery_operation_status: Upon failure or - partial success. Additional data describing Sensitive Data Discovery enable/disable operation. - :vartype operation_status_properties_sensitive_data_discovery_operation_status: - ~azure.mgmt.security.v2022_12_01_preview.models.OperationStatus - :ivar scan_results_event_grid_topic_resource_id: Optional. Resource id of an Event Grid Topic - to send scan results to. - :vartype scan_results_event_grid_topic_resource_id: str - :ivar operation_status_properties_malware_scanning_operation_status: Upon failure or partial - success. Additional data describing Malware Scanning enable/disable operation. - :vartype operation_status_properties_malware_scanning_operation_status: - ~azure.mgmt.security.v2022_12_01_preview.models.OperationStatus - :ivar is_enabled_properties_malware_scanning_on_upload_is_enabled: Indicates whether On Upload - malware scanning should be enabled. - :vartype is_enabled_properties_malware_scanning_on_upload_is_enabled: bool - :ivar cap_gb_per_month: Defines the max GB to be scanned per Month. Set to -1 if no capping is - needed. - :vartype cap_gb_per_month: int + :ivar properties: Defender for Storage resource properties. + :vartype properties: + ~azure.mgmt.security.v2022_12_01_preview.models.DefenderForStorageSettingProperties """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "operation_status_properties_sensitive_data_discovery_operation_status": {"readonly": True}, - "operation_status_properties_malware_scanning_operation_status": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "is_enabled_properties_is_enabled": {"key": "properties.isEnabled", "type": "bool"}, - "override_subscription_level_settings": {"key": "properties.overrideSubscriptionLevelSettings", "type": "bool"}, - "is_enabled_properties_sensitive_data_discovery_is_enabled": { - "key": "properties.sensitiveDataDiscovery.isEnabled", - "type": "bool", - }, - "operation_status_properties_sensitive_data_discovery_operation_status": { - "key": "properties.sensitiveDataDiscovery.operationStatus", - "type": "OperationStatus", - }, - "scan_results_event_grid_topic_resource_id": { - "key": "properties.malwareScanning.scanResultsEventGridTopicResourceId", - "type": "str", - }, - "operation_status_properties_malware_scanning_operation_status": { - "key": "properties.malwareScanning.operationStatus", - "type": "OperationStatus", - }, - "is_enabled_properties_malware_scanning_on_upload_is_enabled": { - "key": "properties.malwareScanning.onUpload.isEnabled", - "type": "bool", - }, - "cap_gb_per_month": {"key": "properties.malwareScanning.onUpload.capGBPerMonth", "type": "int"}, + "properties": {"key": "properties", "type": "DefenderForStorageSettingProperties"}, + } + + def __init__( + self, *, properties: Optional["_models.DefenderForStorageSettingProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword properties: Defender for Storage resource properties. + :paramtype properties: + ~azure.mgmt.security.v2022_12_01_preview.models.DefenderForStorageSettingProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class DefenderForStorageSettingProperties(_serialization.Model): + """Defender for Storage resource properties. + + :ivar is_enabled: Indicates whether Defender for Storage is enabled on this storage account. + :vartype is_enabled: bool + :ivar malware_scanning: Properties of Malware Scanning. + :vartype malware_scanning: + ~azure.mgmt.security.v2022_12_01_preview.models.MalwareScanningProperties + :ivar sensitive_data_discovery: Properties of Sensitive Data Discovery. + :vartype sensitive_data_discovery: + ~azure.mgmt.security.v2022_12_01_preview.models.SensitiveDataDiscoveryProperties + :ivar override_subscription_level_settings: Indicates whether the settings defined for this + storage account should override the settings defined for the subscription. + :vartype override_subscription_level_settings: bool + """ + + _attribute_map = { + "is_enabled": {"key": "isEnabled", "type": "bool"}, + "malware_scanning": {"key": "malwareScanning", "type": "MalwareScanningProperties"}, + "sensitive_data_discovery": {"key": "sensitiveDataDiscovery", "type": "SensitiveDataDiscoveryProperties"}, + "override_subscription_level_settings": {"key": "overrideSubscriptionLevelSettings", "type": "bool"}, } def __init__( self, *, - is_enabled_properties_is_enabled: Optional[bool] = None, + is_enabled: Optional[bool] = None, + malware_scanning: Optional["_models.MalwareScanningProperties"] = None, + sensitive_data_discovery: Optional["_models.SensitiveDataDiscoveryProperties"] = None, override_subscription_level_settings: Optional[bool] = None, - is_enabled_properties_sensitive_data_discovery_is_enabled: Optional[bool] = None, - scan_results_event_grid_topic_resource_id: Optional[str] = None, - is_enabled_properties_malware_scanning_on_upload_is_enabled: Optional[bool] = None, - cap_gb_per_month: Optional[int] = None, **kwargs: Any ) -> None: """ - :keyword is_enabled_properties_is_enabled: Indicates whether Defender for Storage is enabled on - this storage account. - :paramtype is_enabled_properties_is_enabled: bool + :keyword is_enabled: Indicates whether Defender for Storage is enabled on this storage account. + :paramtype is_enabled: bool + :keyword malware_scanning: Properties of Malware Scanning. + :paramtype malware_scanning: + ~azure.mgmt.security.v2022_12_01_preview.models.MalwareScanningProperties + :keyword sensitive_data_discovery: Properties of Sensitive Data Discovery. + :paramtype sensitive_data_discovery: + ~azure.mgmt.security.v2022_12_01_preview.models.SensitiveDataDiscoveryProperties :keyword override_subscription_level_settings: Indicates whether the settings defined for this storage account should override the settings defined for the subscription. :paramtype override_subscription_level_settings: bool - :keyword is_enabled_properties_sensitive_data_discovery_is_enabled: Indicates whether Sensitive - Data Discovery should be enabled. - :paramtype is_enabled_properties_sensitive_data_discovery_is_enabled: bool - :keyword scan_results_event_grid_topic_resource_id: Optional. Resource id of an Event Grid - Topic to send scan results to. - :paramtype scan_results_event_grid_topic_resource_id: str - :keyword is_enabled_properties_malware_scanning_on_upload_is_enabled: Indicates whether On - Upload malware scanning should be enabled. - :paramtype is_enabled_properties_malware_scanning_on_upload_is_enabled: bool - :keyword cap_gb_per_month: Defines the max GB to be scanned per Month. Set to -1 if no capping - is needed. - :paramtype cap_gb_per_month: int """ super().__init__(**kwargs) - self.is_enabled_properties_is_enabled = is_enabled_properties_is_enabled + self.is_enabled = is_enabled + self.malware_scanning = malware_scanning + self.sensitive_data_discovery = sensitive_data_discovery self.override_subscription_level_settings = override_subscription_level_settings - self.is_enabled_properties_sensitive_data_discovery_is_enabled = ( - is_enabled_properties_sensitive_data_discovery_is_enabled - ) - self.operation_status_properties_sensitive_data_discovery_operation_status = None - self.scan_results_event_grid_topic_resource_id = scan_results_event_grid_topic_resource_id - self.operation_status_properties_malware_scanning_operation_status = None - self.is_enabled_properties_malware_scanning_on_upload_is_enabled = ( - is_enabled_properties_malware_scanning_on_upload_is_enabled - ) - self.cap_gb_per_month = cap_gb_per_month class ErrorAdditionalInfo(_serialization.Model): @@ -239,6 +214,81 @@ def __init__(self, **kwargs: Any) -> None: self.info = None +class MalwareScanningProperties(_serialization.Model): + """Properties of Malware Scanning. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar on_upload: Properties of On Upload malware scanning. + :vartype on_upload: ~azure.mgmt.security.v2022_12_01_preview.models.OnUploadProperties + :ivar scan_results_event_grid_topic_resource_id: Optional. Resource id of an Event Grid Topic + to send scan results to. + :vartype scan_results_event_grid_topic_resource_id: str + :ivar operation_status: Upon failure or partial success. Additional data describing Malware + Scanning enable/disable operation. + :vartype operation_status: ~azure.mgmt.security.v2022_12_01_preview.models.OperationStatus + """ + + _validation = { + "operation_status": {"readonly": True}, + } + + _attribute_map = { + "on_upload": {"key": "onUpload", "type": "OnUploadProperties"}, + "scan_results_event_grid_topic_resource_id": {"key": "scanResultsEventGridTopicResourceId", "type": "str"}, + "operation_status": {"key": "operationStatus", "type": "OperationStatus"}, + } + + def __init__( + self, + *, + on_upload: Optional["_models.OnUploadProperties"] = None, + scan_results_event_grid_topic_resource_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword on_upload: Properties of On Upload malware scanning. + :paramtype on_upload: ~azure.mgmt.security.v2022_12_01_preview.models.OnUploadProperties + :keyword scan_results_event_grid_topic_resource_id: Optional. Resource id of an Event Grid + Topic to send scan results to. + :paramtype scan_results_event_grid_topic_resource_id: str + """ + super().__init__(**kwargs) + self.on_upload = on_upload + self.scan_results_event_grid_topic_resource_id = scan_results_event_grid_topic_resource_id + self.operation_status = None + + +class OnUploadProperties(_serialization.Model): + """Properties of On Upload malware scanning. + + :ivar is_enabled: Indicates whether On Upload malware scanning should be enabled. + :vartype is_enabled: bool + :ivar cap_gb_per_month: Defines the max GB to be scanned per Month. Set to -1 if no capping is + needed. + :vartype cap_gb_per_month: int + """ + + _attribute_map = { + "is_enabled": {"key": "isEnabled", "type": "bool"}, + "cap_gb_per_month": {"key": "capGBPerMonth", "type": "int"}, + } + + def __init__( + self, *, is_enabled: Optional[bool] = None, cap_gb_per_month: Optional[int] = None, **kwargs: Any + ) -> None: + """ + :keyword is_enabled: Indicates whether On Upload malware scanning should be enabled. + :paramtype is_enabled: bool + :keyword cap_gb_per_month: Defines the max GB to be scanned per Month. Set to -1 if no capping + is needed. + :paramtype cap_gb_per_month: int + """ + super().__init__(**kwargs) + self.is_enabled = is_enabled + self.cap_gb_per_month = cap_gb_per_month + + class OperationStatus(_serialization.Model): """A status describing the success/failure of the enablement/disablement operation. @@ -263,3 +313,34 @@ def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, super().__init__(**kwargs) self.code = code self.message = message + + +class SensitiveDataDiscoveryProperties(_serialization.Model): + """Properties of Sensitive Data Discovery. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar is_enabled: Indicates whether Sensitive Data Discovery should be enabled. + :vartype is_enabled: bool + :ivar operation_status: Upon failure or partial success. Additional data describing Sensitive + Data Discovery enable/disable operation. + :vartype operation_status: ~azure.mgmt.security.v2022_12_01_preview.models.OperationStatus + """ + + _validation = { + "operation_status": {"readonly": True}, + } + + _attribute_map = { + "is_enabled": {"key": "isEnabled", "type": "bool"}, + "operation_status": {"key": "operationStatus", "type": "OperationStatus"}, + } + + def __init__(self, *, is_enabled: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword is_enabled: Indicates whether Sensitive Data Discovery should be enabled. + :paramtype is_enabled: bool + """ + super().__init__(**kwargs) + self.is_enabled = is_enabled + self.operation_status = None diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_12_01_preview/operations/_defender_for_storage_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_12_01_preview/operations/_defender_for_storage_operations.py index 5278ac4c8957..355e06c8c61a 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_12_01_preview/operations/_defender_for_storage_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2022_12_01_preview/operations/_defender_for_storage_operations.py @@ -19,15 +19,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -154,7 +152,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -168,7 +165,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("DefenderForStorageSetting", pipeline_response) + deserialized = self._deserialize("DefenderForStorageSetting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -285,7 +282,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -299,11 +295,7 @@ def create( 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("DefenderForStorageSetting", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("DefenderForStorageSetting", pipeline_response) + deserialized = self._deserialize("DefenderForStorageSetting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/_metadata.json index daa8293ba44e..56b28b905ead 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/_security_center.py index 10872f6c272f..c6e90ff6fd07 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -99,7 +100,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SecurityCenter": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/_vendor.py +++ /dev/null @@ -1,16 +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 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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/aio/_security_center.py index db1a124056f4..d3c8ba122a4e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/aio/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -101,7 +102,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SecurityCenter": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/aio/operations/_pricings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/aio/operations/_pricings_operations.py index ea064d4bf923..e50b837b4c2f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/aio/operations/_pricings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/aio/operations/_pricings_operations.py @@ -19,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 -from ..._vendor import _convert_request from ...operations._pricings_operations import build_get_request, build_list_request, build_update_request if sys.version_info >= (3, 9): @@ -85,7 +83,6 @@ async def list(self, **kwargs: Any) -> _models.PricingList: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -99,7 +96,7 @@ async def list(self, **kwargs: Any) -> _models.PricingList: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PricingList", pipeline_response) + deserialized = self._deserialize("PricingList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -137,7 +134,6 @@ async def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -151,7 +147,7 @@ async def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Pricing", pipeline_response) + deserialized = self._deserialize("Pricing", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -241,7 +237,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -255,7 +250,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Pricing", pipeline_response) + deserialized = self._deserialize("Pricing", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/operations/_pricings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/operations/_pricings_operations.py index a2538bf85db1..64483ff15ec6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/operations/_pricings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01/operations/_pricings_operations.py @@ -19,15 +19,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -175,7 +173,6 @@ def list(self, **kwargs: Any) -> _models.PricingList: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -189,7 +186,7 @@ def list(self, **kwargs: Any) -> _models.PricingList: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PricingList", pipeline_response) + deserialized = self._deserialize("PricingList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -227,7 +224,6 @@ def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -241,7 +237,7 @@ def get(self, pricing_name: str, **kwargs: Any) -> _models.Pricing: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Pricing", pipeline_response) + deserialized = self._deserialize("Pricing", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -329,7 +325,6 @@ def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO[bytes]], headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -343,7 +338,7 @@ def update(self, pricing_name: str, pricing: Union[_models.Pricing, IO[bytes]], map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Pricing", pipeline_response) + deserialized = self._deserialize("Pricing", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/_metadata.json index 732fa39eeafe..8ed7f01be627 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/_security_center.py index f095eba55d83..2c9a8af50d91 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -102,7 +103,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SecurityCenter": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/_vendor.py +++ /dev/null @@ -1,16 +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 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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/aio/_security_center.py index 59160bc51594..2c2bdff908e6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/aio/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -104,7 +105,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SecurityCenter": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/aio/operations/_security_operators_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/aio/operations/_security_operators_operations.py index 33d6ca6e79a5..f7d1ccab863c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/aio/operations/_security_operators_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/aio/operations/_security_operators_operations.py @@ -18,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 -from ..._vendor import _convert_request from ...operations._security_operators_operations import ( build_create_or_update_request, build_delete_request, @@ -94,7 +92,6 @@ async def list(self, pricing_name: str, **kwargs: Any) -> _models.SecurityOperat headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -108,7 +105,7 @@ async def list(self, pricing_name: str, **kwargs: Any) -> _models.SecurityOperat map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityOperatorList", pipeline_response) + deserialized = self._deserialize("SecurityOperatorList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -151,7 +148,6 @@ async def get(self, pricing_name: str, security_operator_name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -165,7 +161,7 @@ async def get(self, pricing_name: str, security_operator_name: str, **kwargs: An map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityOperator", pipeline_response) + deserialized = self._deserialize("SecurityOperator", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -210,7 +206,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -224,7 +219,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityOperator", pipeline_response) + deserialized = self._deserialize("SecurityOperator", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -269,7 +264,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/operations/_security_operators_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/operations/_security_operators_operations.py index eed31c2d85a4..928c216a68b9 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/operations/_security_operators_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_01_01_preview/operations/_security_operators_operations.py @@ -18,15 +18,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -250,7 +248,6 @@ def list(self, pricing_name: str, **kwargs: Any) -> _models.SecurityOperatorList headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -264,7 +261,7 @@ def list(self, pricing_name: str, **kwargs: Any) -> _models.SecurityOperatorList map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityOperatorList", pipeline_response) + deserialized = self._deserialize("SecurityOperatorList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -307,7 +304,6 @@ def get(self, pricing_name: str, security_operator_name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -321,7 +317,7 @@ def get(self, pricing_name: str, security_operator_name: str, **kwargs: Any) -> map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityOperator", pipeline_response) + deserialized = self._deserialize("SecurityOperator", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -366,7 +362,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -380,7 +375,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityOperator", pipeline_response) + deserialized = self._deserialize("SecurityOperator", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -425,7 +420,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/_metadata.json index 8e0b861846e7..fc703264c9cc 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/_security_center.py index 18450b68915a..99f79dabe49a 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -128,7 +129,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SecurityCenter": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/_vendor.py +++ /dev/null @@ -1,16 +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 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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/_security_center.py index 6ae9c2b1c554..7f26fce9c086 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -130,7 +131,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SecurityCenter": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_health_report_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_health_report_operations.py index 50cde43370aa..02ec4c2a59bc 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_health_report_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_health_report_operations.py @@ -18,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 -from ..._vendor import _convert_request from ...operations._health_report_operations import build_get_request if sys.version_info >= (3, 9): @@ -92,7 +90,6 @@ async def get(self, resource_id: str, health_report_name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -107,7 +104,7 @@ async def get(self, resource_id: str, health_report_name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HealthReport", pipeline_response) + deserialized = self._deserialize("HealthReport", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_health_reports_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_health_reports_operations.py index 3792e7b908a4..1da327c529fa 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_health_reports_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_health_reports_operations.py @@ -20,14 +20,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 from ...operations._health_reports_operations import build_list_request if sys.version_info >= (3, 9): @@ -96,7 +94,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -112,7 +109,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_sql_vulnerability_assessment_baseline_rules_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_sql_vulnerability_assessment_baseline_rules_operations.py index 170e41db5fb8..08ec0d6e65a0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_sql_vulnerability_assessment_baseline_rules_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_sql_vulnerability_assessment_baseline_rules_operations.py @@ -19,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 -from ..._vendor import _convert_request from ...operations._sql_vulnerability_assessment_baseline_rules_operations import ( build_add_request, build_create_or_update_request, @@ -190,7 +188,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -204,7 +201,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RuleResults", pipeline_response) + deserialized = self._deserialize("RuleResults", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -251,7 +248,6 @@ async def get(self, rule_id: str, workspace_id: str, resource_id: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -265,7 +261,7 @@ async def get(self, rule_id: str, workspace_id: str, resource_id: str, **kwargs: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RuleResults", pipeline_response) + deserialized = self._deserialize("RuleResults", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -314,7 +310,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -368,7 +363,6 @@ async def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _mod headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -382,7 +376,7 @@ async def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _mod map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RulesResults", pipeline_response) + deserialized = self._deserialize("RulesResults", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -506,7 +500,6 @@ async def add( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -520,7 +513,7 @@ async def add( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RulesResults", pipeline_response) + deserialized = self._deserialize("RulesResults", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_sql_vulnerability_assessment_scan_results_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_sql_vulnerability_assessment_scan_results_operations.py index 3eee82f318ba..4b4eb913cd80 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_sql_vulnerability_assessment_scan_results_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_sql_vulnerability_assessment_scan_results_operations.py @@ -18,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 -from ..._vendor import _convert_request from ...operations._sql_vulnerability_assessment_scan_results_operations import build_get_request, build_list_request if sys.version_info >= (3, 9): @@ -102,7 +100,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -116,7 +113,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ScanResult", pipeline_response) + deserialized = self._deserialize("ScanResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -164,7 +161,6 @@ async def list(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -178,7 +174,7 @@ async def list(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ScanResults", pipeline_response) + deserialized = self._deserialize("ScanResults", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_sql_vulnerability_assessment_scans_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_sql_vulnerability_assessment_scans_operations.py index a87f3d49fddb..fd3ad7523621 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_sql_vulnerability_assessment_scans_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/aio/operations/_sql_vulnerability_assessment_scans_operations.py @@ -18,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 -from ..._vendor import _convert_request from ...operations._sql_vulnerability_assessment_scans_operations import build_get_request, build_list_request if sys.version_info >= (3, 9): @@ -97,7 +95,6 @@ async def get(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -111,7 +108,7 @@ async def get(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Scan", pipeline_response) + deserialized = self._deserialize("Scan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -155,7 +152,6 @@ async def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _mod headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -169,7 +165,7 @@ async def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _mod map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Scans", pipeline_response) + deserialized = self._deserialize("Scans", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_health_report_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_health_report_operations.py index 06b9958e3a9b..7289a75771c6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_health_report_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_health_report_operations.py @@ -18,15 +18,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -125,7 +123,6 @@ def get(self, resource_id: str, health_report_name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -140,7 +137,7 @@ def get(self, resource_id: str, health_report_name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HealthReport", pipeline_response) + deserialized = self._deserialize("HealthReport", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_health_reports_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_health_reports_operations.py index 3d02f6894d92..fa569acf57e9 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_health_reports_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_health_reports_operations.py @@ -20,15 +20,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -123,7 +121,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -139,7 +136,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_sql_vulnerability_assessment_baseline_rules_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_sql_vulnerability_assessment_baseline_rules_operations.py index 771e6fc8b643..aad41d0aae30 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_sql_vulnerability_assessment_baseline_rules_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_sql_vulnerability_assessment_baseline_rules_operations.py @@ -19,15 +19,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -334,7 +332,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -348,7 +345,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RuleResults", pipeline_response) + deserialized = self._deserialize("RuleResults", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -395,7 +392,6 @@ def get(self, rule_id: str, workspace_id: str, resource_id: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -409,7 +405,7 @@ def get(self, rule_id: str, workspace_id: str, resource_id: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RuleResults", pipeline_response) + deserialized = self._deserialize("RuleResults", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -458,7 +454,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -512,7 +507,6 @@ def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.Ru headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -526,7 +520,7 @@ def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.Ru map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RulesResults", pipeline_response) + deserialized = self._deserialize("RulesResults", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -650,7 +644,6 @@ def add( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -664,7 +657,7 @@ def add( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("RulesResults", pipeline_response) + deserialized = self._deserialize("RulesResults", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_sql_vulnerability_assessment_scan_results_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_sql_vulnerability_assessment_scan_results_operations.py index 3833610cf451..5ed960f6c825 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_sql_vulnerability_assessment_scan_results_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_sql_vulnerability_assessment_scan_results_operations.py @@ -18,15 +18,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -166,7 +164,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -180,7 +177,7 @@ def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ScanResult", pipeline_response) + deserialized = self._deserialize("ScanResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -228,7 +225,6 @@ def list(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -242,7 +238,7 @@ def list(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("ScanResults", pipeline_response) + deserialized = self._deserialize("ScanResults", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_sql_vulnerability_assessment_scans_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_sql_vulnerability_assessment_scans_operations.py index 62d8085b48b6..c94ddecd61e1 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_sql_vulnerability_assessment_scans_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_01_preview/operations/_sql_vulnerability_assessment_scans_operations.py @@ -18,15 +18,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -155,7 +153,6 @@ def get(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -169,7 +166,7 @@ def get(self, scan_id: str, workspace_id: str, resource_id: str, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Scan", pipeline_response) + deserialized = self._deserialize("Scan", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -213,7 +210,6 @@ def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.Sc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -227,7 +223,7 @@ def list(self, workspace_id: str, resource_id: str, **kwargs: Any) -> _models.Sc map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Scans", pipeline_response) + deserialized = self._deserialize("Scans", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_15_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_15_preview/_metadata.json index d85af68fc873..6cf9fe33f926 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_15_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_15_preview/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_15_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_15_preview/_security_center.py index 3d050c7ce348..3d8f9b7d8d99 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_15_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_15_preview/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -96,7 +97,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SecurityCenter": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_15_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_15_preview/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_15_preview/_vendor.py +++ /dev/null @@ -1,16 +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 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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_15_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_15_preview/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_15_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_15_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_15_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_15_preview/aio/_security_center.py index 38f2eeaaa0da..0efeab66dbb9 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_15_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_15_preview/aio/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -98,7 +99,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SecurityCenter": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_15_preview/aio/operations/_sensitivity_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_15_preview/aio/operations/_sensitivity_settings_operations.py index 9d7fe5cb313a..08fb71a79212 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_15_preview/aio/operations/_sensitivity_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_15_preview/aio/operations/_sensitivity_settings_operations.py @@ -19,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 -from ..._vendor import _convert_request from ...operations._sensitivity_settings_operations import ( build_create_or_update_request, build_get_request, @@ -145,7 +143,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -159,7 +156,7 @@ async def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("GetSensitivitySettingsResponse", pipeline_response) + deserialized = self._deserialize("GetSensitivitySettingsResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -195,7 +192,6 @@ async def get(self, **kwargs: Any) -> _models.GetSensitivitySettingsResponse: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -209,7 +205,7 @@ async def get(self, **kwargs: Any) -> _models.GetSensitivitySettingsResponse: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("GetSensitivitySettingsResponse", pipeline_response) + deserialized = self._deserialize("GetSensitivitySettingsResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -245,7 +241,6 @@ async def list(self, **kwargs: Any) -> _models.GetSensitivitySettingsListRespons headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -259,7 +254,7 @@ async def list(self, **kwargs: Any) -> _models.GetSensitivitySettingsListRespons map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("GetSensitivitySettingsListResponse", pipeline_response) + deserialized = self._deserialize("GetSensitivitySettingsListResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_15_preview/operations/_sensitivity_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_15_preview/operations/_sensitivity_settings_operations.py index 77529d42ed0f..de97b5bc4d19 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_15_preview/operations/_sensitivity_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_02_15_preview/operations/_sensitivity_settings_operations.py @@ -19,15 +19,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -204,7 +202,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -218,7 +215,7 @@ def create_or_update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("GetSensitivitySettingsResponse", pipeline_response) + deserialized = self._deserialize("GetSensitivitySettingsResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -254,7 +251,6 @@ def get(self, **kwargs: Any) -> _models.GetSensitivitySettingsResponse: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -268,7 +264,7 @@ def get(self, **kwargs: Any) -> _models.GetSensitivitySettingsResponse: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("GetSensitivitySettingsResponse", pipeline_response) + deserialized = self._deserialize("GetSensitivitySettingsResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -304,7 +300,6 @@ def list(self, **kwargs: Any) -> _models.GetSensitivitySettingsListResponse: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -318,7 +313,7 @@ def list(self, **kwargs: Any) -> _models.GetSensitivitySettingsListResponse: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("GetSensitivitySettingsListResponse", pipeline_response) + deserialized = self._deserialize("GetSensitivitySettingsListResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/_metadata.json index 7fad30edecb6..950f38b8b539 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/_security_center.py index 632f7ebb548f..cf29b2c9274c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -102,7 +103,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SecurityCenter": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/_vendor.py +++ /dev/null @@ -1,16 +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 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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/aio/_security_center.py index 4c748c5cb268..fb2f2f7d32dd 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/aio/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -104,7 +105,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SecurityCenter": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/aio/operations/_security_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/aio/operations/_security_connectors_operations.py index 553600bf374f..82d24c9b25a9 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/aio/operations/_security_connectors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/aio/operations/_security_connectors_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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_connectors_operations import ( build_create_or_update_request, build_delete_request, @@ -102,7 +100,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -118,7 +115,6 @@ def prepare_request(next_link=None): _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 @@ -188,7 +184,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -204,7 +199,6 @@ def prepare_request(next_link=None): _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 @@ -272,7 +266,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -286,7 +279,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityConnector", pipeline_response) + deserialized = self._deserialize("SecurityConnector", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -409,7 +402,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -423,11 +415,7 @@ async def create_or_update( 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("SecurityConnector", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SecurityConnector", pipeline_response) + deserialized = self._deserialize("SecurityConnector", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -547,7 +535,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -561,7 +548,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityConnector", pipeline_response) + deserialized = self._deserialize("SecurityConnector", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -607,7 +594,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/operations/_security_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/operations/_security_connectors_operations.py index 6d18a559e4aa..ba2398f9b8ac 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/operations/_security_connectors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_03_01_preview/operations/_security_connectors_operations.py @@ -21,15 +21,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -301,7 +299,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -317,7 +314,6 @@ def prepare_request(next_link=None): _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 @@ -385,7 +381,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -401,7 +396,6 @@ def prepare_request(next_link=None): _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 @@ -467,7 +461,6 @@ def get(self, resource_group_name: str, security_connector_name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -481,7 +474,7 @@ def get(self, resource_group_name: str, security_connector_name: str, **kwargs: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityConnector", pipeline_response) + deserialized = self._deserialize("SecurityConnector", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -604,7 +597,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -618,11 +610,7 @@ def create_or_update( 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("SecurityConnector", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SecurityConnector", pipeline_response) + deserialized = self._deserialize("SecurityConnector", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -742,7 +730,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -756,7 +743,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityConnector", pipeline_response) + deserialized = self._deserialize("SecurityConnector", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -802,7 +789,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01/_metadata.json index 9ab7d0642c76..6b3f5e9e76da 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01/_security_center.py index e79e8380b7e8..278eafca3079 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -103,7 +104,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SecurityCenter": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01/_vendor.py +++ /dev/null @@ -1,16 +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 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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01/aio/_security_center.py index b24aaa44bed8..412592f43e9c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01/aio/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -105,7 +106,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SecurityCenter": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01/aio/operations/_server_vulnerability_assessments_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01/aio/operations/_server_vulnerability_assessments_settings_operations.py index 1481bc38259a..45488e98cb6a 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01/aio/operations/_server_vulnerability_assessments_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01/aio/operations/_server_vulnerability_assessments_settings_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._server_vulnerability_assessments_settings_operations import ( build_create_or_update_request, build_delete_request, @@ -99,7 +97,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -115,7 +112,6 @@ def prepare_request(next_link=None): _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 @@ -181,7 +177,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -196,7 +191,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServerVulnerabilityAssessmentsSetting", pipeline_response) + deserialized = self._deserialize("ServerVulnerabilityAssessmentsSetting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -316,7 +311,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -331,11 +325,7 @@ async def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ServerVulnerabilityAssessmentsSetting", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ServerVulnerabilityAssessmentsSetting", pipeline_response) + deserialized = self._deserialize("ServerVulnerabilityAssessmentsSetting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -378,7 +368,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01/operations/_server_vulnerability_assessments_settings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01/operations/_server_vulnerability_assessments_settings_operations.py index a23fa3c69574..fc89894f0f99 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01/operations/_server_vulnerability_assessments_settings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01/operations/_server_vulnerability_assessments_settings_operations.py @@ -21,15 +21,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -216,7 +214,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -232,7 +229,6 @@ def prepare_request(next_link=None): _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 @@ -298,7 +294,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -313,7 +308,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ServerVulnerabilityAssessmentsSetting", pipeline_response) + deserialized = self._deserialize("ServerVulnerabilityAssessmentsSetting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -433,7 +428,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -448,11 +442,7 @@ def create_or_update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("ServerVulnerabilityAssessmentsSetting", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ServerVulnerabilityAssessmentsSetting", pipeline_response) + deserialized = self._deserialize("ServerVulnerabilityAssessmentsSetting", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -495,7 +485,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01_preview/_metadata.json index f1512482a57c..8fbf64e4ba9f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01_preview/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01_preview/_security_center.py index 6d56369c69e8..eabf6de97bc7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01_preview/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -96,7 +97,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SecurityCenter": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01_preview/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01_preview/_vendor.py +++ /dev/null @@ -1,16 +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 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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01_preview/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01_preview/aio/_security_center.py index 6d070f704f18..7902f9ad0405 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01_preview/aio/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -98,7 +99,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SecurityCenter": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01_preview/aio/operations/_health_reports_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01_preview/aio/operations/_health_reports_operations.py index 64d93a759030..229dacc91dd6 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01_preview/aio/operations/_health_reports_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01_preview/aio/operations/_health_reports_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._health_reports_operations import build_get_request, build_list_request if sys.version_info >= (3, 9): @@ -97,7 +95,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -113,7 +110,6 @@ def prepare_request(next_link=None): _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 @@ -179,7 +175,6 @@ async def get(self, resource_id: str, health_report_name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -194,7 +189,7 @@ async def get(self, resource_id: str, health_report_name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HealthReport", pipeline_response) + deserialized = self._deserialize("HealthReport", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01_preview/operations/_health_reports_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01_preview/operations/_health_reports_operations.py index 583de677380d..c8b2132a41c9 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01_preview/operations/_health_reports_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_05_01_preview/operations/_health_reports_operations.py @@ -20,15 +20,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -153,7 +151,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -169,7 +166,6 @@ def prepare_request(next_link=None): _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 @@ -235,7 +231,6 @@ def get(self, resource_id: str, health_report_name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -250,7 +245,7 @@ def get(self, resource_id: str, health_report_name: str, **kwargs: Any) -> _mode error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("HealthReport", pipeline_response) + deserialized = self._deserialize("HealthReport", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/_metadata.json index c0adf7caa4a5..c661e06a868b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/_security_center.py index 2ef2daaa4473..deca500dc0f3 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -169,7 +170,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SecurityCenter": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/_vendor.py +++ /dev/null @@ -1,16 +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 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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/_security_center.py index adbd4a7b08ce..97fdca66112e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -171,7 +172,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SecurityCenter": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_azure_dev_ops_orgs_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_azure_dev_ops_orgs_operations.py index 1e279ceebf01..0368ca8db364 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_azure_dev_ops_orgs_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_azure_dev_ops_orgs_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._azure_dev_ops_orgs_operations import ( build_create_or_update_request, build_get_request, @@ -111,7 +111,6 @@ async def list_available( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -126,7 +125,7 @@ async def list_available( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureDevOpsOrgListResponse", pipeline_response) + deserialized = self._deserialize("AzureDevOpsOrgListResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -178,7 +177,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -194,7 +192,6 @@ def prepare_request(next_link=None): _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 @@ -268,7 +265,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -283,7 +279,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response) + deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -297,7 +293,7 @@ async def _create_or_update_initial( org_name: str, azure_dev_ops_org: Union[_models.AzureDevOpsOrg, IO[bytes]], **kwargs: Any - ) -> _models.AzureDevOpsOrg: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -313,7 +309,7 @@ async def _create_or_update_initial( "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AzureDevOpsOrg] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -335,10 +331,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -346,15 +342,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -483,10 +479,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response) + deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -518,7 +515,7 @@ async def _update_initial( org_name: str, azure_dev_ops_org: Union[_models.AzureDevOpsOrg, IO[bytes]], **kwargs: Any - ) -> _models.AzureDevOpsOrg: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -534,7 +531,7 @@ async def _update_initial( "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AzureDevOpsOrg] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -556,10 +553,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -567,15 +564,15 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -704,10 +701,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response) + deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_azure_dev_ops_projects_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_azure_dev_ops_projects_operations.py index 9e23658e479d..057276b58a82 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_azure_dev_ops_projects_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_azure_dev_ops_projects_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._azure_dev_ops_projects_operations import ( build_create_or_update_request, build_get_request, @@ -115,7 +115,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -131,7 +130,6 @@ def prepare_request(next_link=None): _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 @@ -208,7 +206,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -223,7 +220,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureDevOpsProject", pipeline_response) + deserialized = self._deserialize("AzureDevOpsProject", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -238,7 +235,7 @@ async def _create_or_update_initial( project_name: str, azure_dev_ops_project: Union[_models.AzureDevOpsProject, IO[bytes]], **kwargs: Any - ) -> _models.AzureDevOpsProject: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -254,7 +251,7 @@ async def _create_or_update_initial( "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AzureDevOpsProject] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -277,10 +274,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -288,15 +285,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AzureDevOpsProject", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AzureDevOpsProject", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -435,10 +432,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AzureDevOpsProject", pipeline_response) + deserialized = self._deserialize("AzureDevOpsProject", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -471,7 +469,7 @@ async def _update_initial( project_name: str, azure_dev_ops_project: Union[_models.AzureDevOpsProject, IO[bytes]], **kwargs: Any - ) -> _models.AzureDevOpsProject: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -487,7 +485,7 @@ async def _update_initial( "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AzureDevOpsProject] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -510,10 +508,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -521,15 +519,15 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AzureDevOpsProject", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AzureDevOpsProject", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -668,10 +666,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AzureDevOpsProject", pipeline_response) + deserialized = self._deserialize("AzureDevOpsProject", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_azure_dev_ops_repos_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_azure_dev_ops_repos_operations.py index 3fc87a299127..d787a4f97cf8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_azure_dev_ops_repos_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_azure_dev_ops_repos_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._azure_dev_ops_repos_operations import ( build_create_or_update_request, build_get_request, @@ -119,7 +119,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -135,7 +134,6 @@ def prepare_request(next_link=None): _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 @@ -221,7 +219,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -236,7 +233,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response) + deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -252,7 +249,7 @@ async def _create_or_update_initial( repo_name: str, azure_dev_ops_repository: Union[_models.AzureDevOpsRepository, IO[bytes]], **kwargs: Any - ) -> _models.AzureDevOpsRepository: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -268,7 +265,7 @@ async def _create_or_update_initial( "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AzureDevOpsRepository] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -292,10 +289,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -303,15 +300,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -461,10 +458,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response) + deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -498,7 +496,7 @@ async def _update_initial( repo_name: str, azure_dev_ops_repository: Union[_models.AzureDevOpsRepository, IO[bytes]], **kwargs: Any - ) -> _models.AzureDevOpsRepository: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -514,7 +512,7 @@ async def _update_initial( "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AzureDevOpsRepository] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -538,10 +536,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -549,15 +547,15 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -707,10 +705,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response) + deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_dev_ops_configurations_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_dev_ops_configurations_operations.py index f5ef187309a5..470786ec5fac 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_dev_ops_configurations_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_dev_ops_configurations_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._dev_ops_configurations_operations import ( build_create_or_update_request, build_delete_request, @@ -113,7 +113,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -129,7 +128,6 @@ def prepare_request(next_link=None): _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 @@ -200,7 +198,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +212,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DevOpsConfiguration", pipeline_response) + deserialized = self._deserialize("DevOpsConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -228,7 +225,7 @@ async def _create_or_update_initial( security_connector_name: str, dev_ops_configuration: Union[_models.DevOpsConfiguration, IO[bytes]], **kwargs: Any - ) -> _models.DevOpsConfiguration: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -244,7 +241,7 @@ async def _create_or_update_initial( "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DevOpsConfiguration] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -265,10 +262,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -276,18 +273,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DevOpsConfiguration", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("DevOpsConfiguration", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("DevOpsConfiguration", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -407,10 +401,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DevOpsConfiguration", pipeline_response) + deserialized = self._deserialize("DevOpsConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -441,7 +436,7 @@ async def _update_initial( security_connector_name: str, dev_ops_configuration: Union[_models.DevOpsConfiguration, IO[bytes]], **kwargs: Any - ) -> _models.DevOpsConfiguration: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -457,7 +452,7 @@ async def _update_initial( "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DevOpsConfiguration] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -478,10 +473,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -489,15 +484,15 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DevOpsConfiguration", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("DevOpsConfiguration", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -617,10 +612,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DevOpsConfiguration", pipeline_response) + deserialized = self._deserialize("DevOpsConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -645,9 +641,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, security_connector_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -662,7 +658,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop( "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") ) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -672,10 +668,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -683,12 +679,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -718,7 +722,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, security_connector_name=security_connector_name, api_version=api_version, @@ -727,6 +731,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_dev_ops_operation_results_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_dev_ops_operation_results_operations.py index 5c614e749a62..834da54757a7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_dev_ops_operation_results_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_dev_ops_operation_results_operations.py @@ -18,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 -from ..._vendor import _convert_request from ...operations._dev_ops_operation_results_operations import build_get_request if sys.version_info >= (3, 9): @@ -100,7 +98,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -115,7 +112,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationStatusResult", pipeline_response) + deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_git_hub_owners_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_git_hub_owners_operations.py index 8e7737733588..fea9b0d0249b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_git_hub_owners_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_git_hub_owners_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._git_hub_owners_operations import build_get_request, build_list_available_request, build_list_request if sys.version_info >= (3, 9): @@ -100,7 +98,6 @@ async def list_available( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -115,7 +112,7 @@ async def list_available( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GitHubOwnerListResponse", pipeline_response) + deserialized = self._deserialize("GitHubOwnerListResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -167,7 +164,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -183,7 +179,6 @@ def prepare_request(next_link=None): _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 @@ -257,7 +252,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -272,7 +266,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GitHubOwner", pipeline_response) + deserialized = self._deserialize("GitHubOwner", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_git_hub_repos_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_git_hub_repos_operations.py index 22cbc95cb5b7..4191aeab1d39 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_git_hub_repos_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_git_hub_repos_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._git_hub_repos_operations import build_get_request, build_list_request if sys.version_info >= (3, 9): @@ -107,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -123,7 +120,6 @@ def prepare_request(next_link=None): _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 @@ -200,7 +196,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +210,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GitHubRepository", pipeline_response) + deserialized = self._deserialize("GitHubRepository", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_git_lab_groups_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_git_lab_groups_operations.py index 748dfd88c04f..0c4c2c64610d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_git_lab_groups_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_git_lab_groups_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._git_lab_groups_operations import build_get_request, build_list_available_request, build_list_request if sys.version_info >= (3, 9): @@ -100,7 +98,6 @@ async def list_available( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -115,7 +112,7 @@ async def list_available( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GitLabGroupListResponse", pipeline_response) + deserialized = self._deserialize("GitLabGroupListResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -167,7 +164,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -183,7 +179,6 @@ def prepare_request(next_link=None): _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 @@ -257,7 +252,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -272,7 +266,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GitLabGroup", pipeline_response) + deserialized = self._deserialize("GitLabGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_git_lab_projects_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_git_lab_projects_operations.py index 5baa86d47d47..35cdda45288c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_git_lab_projects_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_git_lab_projects_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._git_lab_projects_operations import build_get_request, build_list_request if sys.version_info >= (3, 9): @@ -109,7 +107,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -125,7 +122,6 @@ def prepare_request(next_link=None): _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 @@ -209,7 +205,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -224,7 +219,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GitLabProject", pipeline_response) + deserialized = self._deserialize("GitLabProject", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_git_lab_subgroups_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_git_lab_subgroups_operations.py index b59c5cd0eeb5..3218ebdc1a67 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_git_lab_subgroups_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/aio/operations/_git_lab_subgroups_operations.py @@ -18,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 -from ..._vendor import _convert_request from ...operations._git_lab_subgroups_operations import build_list_request if sys.version_info >= (3, 9): @@ -100,7 +98,6 @@ async def list( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -115,7 +112,7 @@ async def list( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GitLabGroupListResponse", pipeline_response) + deserialized = self._deserialize("GitLabGroupListResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_azure_dev_ops_orgs_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_azure_dev_ops_orgs_operations.py index d0c07013a758..eae89e54e0ab 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_azure_dev_ops_orgs_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_azure_dev_ops_orgs_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,6 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -281,7 +281,6 @@ def list_available( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -296,7 +295,7 @@ def list_available( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureDevOpsOrgListResponse", pipeline_response) + deserialized = self._deserialize("AzureDevOpsOrgListResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -348,7 +347,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -364,7 +362,6 @@ def prepare_request(next_link=None): _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 @@ -438,7 +435,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -453,7 +449,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response) + deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -467,7 +463,7 @@ def _create_or_update_initial( org_name: str, azure_dev_ops_org: Union[_models.AzureDevOpsOrg, IO[bytes]], **kwargs: Any - ) -> _models.AzureDevOpsOrg: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -483,7 +479,7 @@ def _create_or_update_initial( "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AzureDevOpsOrg] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -505,10 +501,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -516,15 +512,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -653,10 +649,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response) + deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -687,7 +684,7 @@ def _update_initial( org_name: str, azure_dev_ops_org: Union[_models.AzureDevOpsOrg, IO[bytes]], **kwargs: Any - ) -> _models.AzureDevOpsOrg: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -703,7 +700,7 @@ def _update_initial( "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AzureDevOpsOrg] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -725,10 +722,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -736,15 +733,15 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -873,10 +870,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response) + deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_azure_dev_ops_projects_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_azure_dev_ops_projects_operations.py index 65eeb835c793..8e6ac85cd8ba 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_azure_dev_ops_projects_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_azure_dev_ops_projects_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,6 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -272,7 +272,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -288,7 +287,6 @@ def prepare_request(next_link=None): _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 @@ -365,7 +363,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -380,7 +377,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureDevOpsProject", pipeline_response) + deserialized = self._deserialize("AzureDevOpsProject", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -395,7 +392,7 @@ def _create_or_update_initial( project_name: str, azure_dev_ops_project: Union[_models.AzureDevOpsProject, IO[bytes]], **kwargs: Any - ) -> _models.AzureDevOpsProject: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -411,7 +408,7 @@ def _create_or_update_initial( "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AzureDevOpsProject] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -434,10 +431,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -445,15 +442,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AzureDevOpsProject", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AzureDevOpsProject", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -592,10 +589,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AzureDevOpsProject", pipeline_response) + deserialized = self._deserialize("AzureDevOpsProject", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -627,7 +625,7 @@ def _update_initial( project_name: str, azure_dev_ops_project: Union[_models.AzureDevOpsProject, IO[bytes]], **kwargs: Any - ) -> _models.AzureDevOpsProject: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -643,7 +641,7 @@ def _update_initial( "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AzureDevOpsProject] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -666,10 +664,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -677,15 +675,15 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AzureDevOpsProject", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AzureDevOpsProject", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -824,10 +822,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AzureDevOpsProject", pipeline_response) + deserialized = self._deserialize("AzureDevOpsProject", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_azure_dev_ops_repos_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_azure_dev_ops_repos_operations.py index bbdbdddefe23..28ebe9f37d02 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_azure_dev_ops_repos_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_azure_dev_ops_repos_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,6 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -288,7 +288,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -304,7 +303,6 @@ def prepare_request(next_link=None): _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 @@ -390,7 +388,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -405,7 +402,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response) + deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -421,7 +418,7 @@ def _create_or_update_initial( repo_name: str, azure_dev_ops_repository: Union[_models.AzureDevOpsRepository, IO[bytes]], **kwargs: Any - ) -> _models.AzureDevOpsRepository: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -437,7 +434,7 @@ def _create_or_update_initial( "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AzureDevOpsRepository] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -461,10 +458,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -472,15 +469,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -630,10 +627,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response) + deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -666,7 +664,7 @@ def _update_initial( repo_name: str, azure_dev_ops_repository: Union[_models.AzureDevOpsRepository, IO[bytes]], **kwargs: Any - ) -> _models.AzureDevOpsRepository: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -682,7 +680,7 @@ def _update_initial( "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AzureDevOpsRepository] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -706,10 +704,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -717,15 +715,15 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -875,10 +873,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response) + deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_dev_ops_configurations_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_dev_ops_configurations_operations.py index f3f882e897ec..694c9f8b5f41 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_dev_ops_configurations_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_dev_ops_configurations_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,6 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -280,7 +280,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -296,7 +295,6 @@ def prepare_request(next_link=None): _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 @@ -365,7 +363,6 @@ def get(self, resource_group_name: str, security_connector_name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -380,7 +377,7 @@ def get(self, resource_group_name: str, security_connector_name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DevOpsConfiguration", pipeline_response) + deserialized = self._deserialize("DevOpsConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -393,7 +390,7 @@ def _create_or_update_initial( security_connector_name: str, dev_ops_configuration: Union[_models.DevOpsConfiguration, IO[bytes]], **kwargs: Any - ) -> _models.DevOpsConfiguration: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -409,7 +406,7 @@ def _create_or_update_initial( "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DevOpsConfiguration] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -430,10 +427,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -441,18 +438,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DevOpsConfiguration", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("DevOpsConfiguration", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("DevOpsConfiguration", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -572,10 +566,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DevOpsConfiguration", pipeline_response) + deserialized = self._deserialize("DevOpsConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -605,7 +600,7 @@ def _update_initial( security_connector_name: str, dev_ops_configuration: Union[_models.DevOpsConfiguration, IO[bytes]], **kwargs: Any - ) -> _models.DevOpsConfiguration: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -621,7 +616,7 @@ def _update_initial( "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DevOpsConfiguration] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -642,10 +637,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -653,15 +648,15 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DevOpsConfiguration", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("DevOpsConfiguration", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -781,10 +776,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DevOpsConfiguration", pipeline_response) + deserialized = self._deserialize("DevOpsConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -808,9 +804,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, security_connector_name: str, **kwargs: Any - ) -> None: + def _delete_initial(self, resource_group_name: str, security_connector_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -825,7 +819,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop( "api_version", _params.pop("api-version", self._api_version or "2023-09-01-preview") ) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -835,10 +829,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -846,12 +840,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, security_connector_name: str, **kwargs: Any) -> LROPoller[None]: @@ -879,7 +881,7 @@ def begin_delete(self, resource_group_name: str, security_connector_name: str, * lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, security_connector_name=security_connector_name, api_version=api_version, @@ -888,6 +890,7 @@ def begin_delete(self, resource_group_name: str, security_connector_name: str, * params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_dev_ops_operation_results_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_dev_ops_operation_results_operations.py index dc42f077fb6d..c894e73c1bd0 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_dev_ops_operation_results_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_dev_ops_operation_results_operations.py @@ -18,15 +18,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -141,7 +139,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -156,7 +153,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationStatusResult", pipeline_response) + deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_git_hub_owners_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_git_hub_owners_operations.py index 97ec703acf52..1b45432a77ae 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_git_hub_owners_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_git_hub_owners_operations.py @@ -20,15 +20,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -202,7 +200,6 @@ def list_available( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -217,7 +214,7 @@ def list_available( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GitHubOwnerListResponse", pipeline_response) + deserialized = self._deserialize("GitHubOwnerListResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -269,7 +266,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -285,7 +281,6 @@ def prepare_request(next_link=None): _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 @@ -359,7 +354,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -374,7 +368,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GitHubOwner", pipeline_response) + deserialized = self._deserialize("GitHubOwner", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_git_hub_repos_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_git_hub_repos_operations.py index 5702ad2614e7..e0c51ed321e2 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_git_hub_repos_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_git_hub_repos_operations.py @@ -20,15 +20,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -183,7 +181,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -199,7 +196,6 @@ def prepare_request(next_link=None): _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 @@ -276,7 +272,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -291,7 +286,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GitHubRepository", pipeline_response) + deserialized = self._deserialize("GitHubRepository", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_git_lab_groups_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_git_lab_groups_operations.py index 4f00007df6db..661bc2578fbe 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_git_lab_groups_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_git_lab_groups_operations.py @@ -20,15 +20,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -202,7 +200,6 @@ def list_available( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -217,7 +214,7 @@ def list_available( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GitLabGroupListResponse", pipeline_response) + deserialized = self._deserialize("GitLabGroupListResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -269,7 +266,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -285,7 +281,6 @@ def prepare_request(next_link=None): _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 @@ -359,7 +354,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -374,7 +368,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GitLabGroup", pipeline_response) + deserialized = self._deserialize("GitLabGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_git_lab_projects_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_git_lab_projects_operations.py index e197bf712f03..1ee42b40324c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_git_lab_projects_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_git_lab_projects_operations.py @@ -20,15 +20,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -185,7 +183,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -201,7 +198,6 @@ def prepare_request(next_link=None): _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 @@ -285,7 +281,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -300,7 +295,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GitLabProject", pipeline_response) + deserialized = self._deserialize("GitLabProject", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_git_lab_subgroups_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_git_lab_subgroups_operations.py index 93f3a7a5f0c9..20ffed985452 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_git_lab_subgroups_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_09_01_preview/operations/_git_lab_subgroups_operations.py @@ -18,15 +18,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -137,7 +135,6 @@ def list( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -152,7 +149,7 @@ def list( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GitLabGroupListResponse", pipeline_response) + deserialized = self._deserialize("GitLabGroupListResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_10_01_preview/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_10_01_preview/_metadata.json index a63d3fe1f82d..3aae61e7438e 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_10_01_preview/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_10_01_preview/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_10_01_preview/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_10_01_preview/_security_center.py index 4a1d5925027d..8f482ff8f0c4 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_10_01_preview/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_10_01_preview/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -102,7 +103,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SecurityCenter": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_10_01_preview/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_10_01_preview/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_10_01_preview/_vendor.py +++ /dev/null @@ -1,16 +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 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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_10_01_preview/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_10_01_preview/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_10_01_preview/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_10_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_10_01_preview/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_10_01_preview/aio/_security_center.py index 95eef1761d60..751e3aada0df 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_10_01_preview/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_10_01_preview/aio/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -104,7 +105,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SecurityCenter": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_10_01_preview/aio/operations/_security_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_10_01_preview/aio/operations/_security_connectors_operations.py index 1bebc9ecdf7a..3fe315f55a9b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_10_01_preview/aio/operations/_security_connectors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_10_01_preview/aio/operations/_security_connectors_operations.py @@ -21,15 +21,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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_connectors_operations import ( build_create_or_update_request, build_delete_request, @@ -102,7 +100,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -118,7 +115,6 @@ def prepare_request(next_link=None): _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 @@ -188,7 +184,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -204,7 +199,6 @@ def prepare_request(next_link=None): _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 @@ -272,7 +266,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -286,7 +279,7 @@ async def get( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityConnector", pipeline_response) + deserialized = self._deserialize("SecurityConnector", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -409,7 +402,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -423,11 +415,7 @@ async def create_or_update( 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("SecurityConnector", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SecurityConnector", pipeline_response) + deserialized = self._deserialize("SecurityConnector", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -547,7 +535,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -561,7 +548,7 @@ async def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityConnector", pipeline_response) + deserialized = self._deserialize("SecurityConnector", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -607,7 +594,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_10_01_preview/operations/_security_connectors_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_10_01_preview/operations/_security_connectors_operations.py index aa330ea3ac83..4d2a76499ae9 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_10_01_preview/operations/_security_connectors_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_10_01_preview/operations/_security_connectors_operations.py @@ -21,15 +21,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -301,7 +299,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -317,7 +314,6 @@ def prepare_request(next_link=None): _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 @@ -385,7 +381,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -401,7 +396,6 @@ def prepare_request(next_link=None): _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 @@ -467,7 +461,6 @@ def get(self, resource_group_name: str, security_connector_name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -481,7 +474,7 @@ def get(self, resource_group_name: str, security_connector_name: str, **kwargs: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityConnector", pipeline_response) + deserialized = self._deserialize("SecurityConnector", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -604,7 +597,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -618,11 +610,7 @@ def create_or_update( 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("SecurityConnector", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SecurityConnector", pipeline_response) + deserialized = self._deserialize("SecurityConnector", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -742,7 +730,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -756,7 +743,7 @@ def update( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("SecurityConnector", pipeline_response) + deserialized = self._deserialize("SecurityConnector", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -802,7 +789,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_11_15/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_11_15/_metadata.json index 1cdcdc5c20d1..032a4d706ddd 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_11_15/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_11_15/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_11_15/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_11_15/_security_center.py index 8a8ddd7dc45c..a1b3ec5e087b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_11_15/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_11_15/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -103,7 +104,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SecurityCenter": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_11_15/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_11_15/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_11_15/_vendor.py +++ /dev/null @@ -1,16 +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 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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_11_15/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_11_15/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_11_15/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_11_15/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_11_15/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_11_15/aio/_security_center.py index cef57f7964c6..966d998bd78b 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_11_15/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_11_15/aio/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -106,7 +107,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SecurityCenter": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_11_15/aio/operations/_api_collections_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_11_15/aio/operations/_api_collections_operations.py index 74519e736fd4..3b9038127105 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_11_15/aio/operations/_api_collections_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_11_15/aio/operations/_api_collections_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar, Union, cast +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -17,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 @@ -30,7 +31,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._api_collections_operations import ( build_get_by_azure_api_management_service_request, build_list_by_azure_api_management_service_request, @@ -103,7 +103,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -119,7 +118,6 @@ def prepare_request(next_link=None): _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 @@ -188,7 +186,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -204,7 +201,6 @@ def prepare_request(next_link=None): _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 @@ -280,7 +276,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -296,7 +291,6 @@ def prepare_request(next_link=None): _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 @@ -372,7 +366,6 @@ async def get_by_azure_api_management_service( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -387,7 +380,7 @@ async def get_by_azure_api_management_service( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiCollection", pipeline_response) + deserialized = self._deserialize("ApiCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -396,7 +389,7 @@ async def get_by_azure_api_management_service( async def _onboard_azure_api_management_api_initial( # pylint: disable=name-too-long self, resource_group_name: str, service_name: str, api_id: str, **kwargs: Any - ) -> _models.ApiCollection: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -409,7 +402,7 @@ async def _onboard_azure_api_management_api_initial( # pylint: disable=name-too _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-11-15")) - cls: ClsType[_models.ApiCollection] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_onboard_azure_api_management_api_request( resource_group_name=resource_group_name, @@ -420,10 +413,10 @@ async def _onboard_azure_api_management_api_initial( # pylint: disable=name-too headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -431,18 +424,19 @@ async def _onboard_azure_api_management_api_initial( # pylint: disable=name-too response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ApiCollection", pipeline_response) - if response.status_code == 201: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = self._deserialize("ApiCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -492,10 +486,11 @@ async def begin_onboard_azure_api_management_api( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiCollection", pipeline_response) + deserialized = self._deserialize("ApiCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -563,7 +558,6 @@ async def offboard_azure_api_management_api( # pylint: disable=inconsistent-ret headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_11_15/operations/_api_collections_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_11_15/operations/_api_collections_operations.py index 777ee1535fd1..e036e41140f7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_11_15/operations/_api_collections_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2023_11_15/operations/_api_collections_operations.py @@ -7,7 +7,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar, Union, cast +from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast import urllib.parse from azure.core.exceptions import ( @@ -16,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -30,7 +31,6 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -314,7 +314,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -330,7 +329,6 @@ def prepare_request(next_link=None): _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 @@ -398,7 +396,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -414,7 +411,6 @@ def prepare_request(next_link=None): _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 @@ -489,7 +485,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -505,7 +500,6 @@ def prepare_request(next_link=None): _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 @@ -581,7 +575,6 @@ def get_by_azure_api_management_service( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -596,7 +589,7 @@ def get_by_azure_api_management_service( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ApiCollection", pipeline_response) + deserialized = self._deserialize("ApiCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -605,7 +598,7 @@ def get_by_azure_api_management_service( def _onboard_azure_api_management_api_initial( # pylint: disable=name-too-long self, resource_group_name: str, service_name: str, api_id: str, **kwargs: Any - ) -> _models.ApiCollection: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -618,7 +611,7 @@ def _onboard_azure_api_management_api_initial( # pylint: disable=name-too-long _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-11-15")) - cls: ClsType[_models.ApiCollection] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_onboard_azure_api_management_api_request( resource_group_name=resource_group_name, @@ -629,10 +622,10 @@ def _onboard_azure_api_management_api_initial( # pylint: disable=name-too-long headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -640,18 +633,19 @@ def _onboard_azure_api_management_api_initial( # pylint: disable=name-too-long response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ApiCollection", pipeline_response) - if response.status_code == 201: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - deserialized = self._deserialize("ApiCollection", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -700,10 +694,11 @@ def begin_onboard_azure_api_management_api( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ApiCollection", pipeline_response) + deserialized = self._deserialize("ApiCollection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -771,7 +766,6 @@ def offboard_azure_api_management_api( # pylint: disable=inconsistent-return-st headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_01_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_01_01/_metadata.json index 9f706f34cd51..ad9225e8243f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_01_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_01_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_01_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_01_01/_security_center.py index 55e6b7bf7bbf..eaa3d340ed9d 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_01_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_01_01/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -93,7 +94,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SecurityCenter": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_01_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_01_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_01_01/_vendor.py +++ /dev/null @@ -1,16 +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 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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_01_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_01_01/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_01_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_01_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_01_01/aio/_security_center.py index 0e0d3813e2d8..366a8d8e8345 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_01_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_01_01/aio/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -95,7 +96,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SecurityCenter": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_01_01/aio/operations/_pricings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_01_01/aio/operations/_pricings_operations.py index 16fbb01e20f8..ddb388c2e7fe 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_01_01/aio/operations/_pricings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_01_01/aio/operations/_pricings_operations.py @@ -19,14 +19,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 -from ..._vendor import _convert_request from ...operations._pricings_operations import ( build_delete_request, build_get_request, @@ -100,7 +98,6 @@ async def get(self, scope_id: str, pricing_name: str, **kwargs: Any) -> _models. headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -114,7 +111,7 @@ async def get(self, scope_id: str, pricing_name: str, **kwargs: Any) -> _models. map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Pricing", pipeline_response) + deserialized = self._deserialize("Pricing", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -237,7 +234,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -251,11 +247,7 @@ async def update( 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("Pricing", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Pricing", pipeline_response) + deserialized = self._deserialize("Pricing", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -301,7 +293,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -359,7 +350,6 @@ async def list(self, scope_id: str, filter: Optional[str] = None, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -373,7 +363,7 @@ async def list(self, scope_id: str, filter: Optional[str] = None, **kwargs: Any) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PricingList", pipeline_response) + deserialized = self._deserialize("PricingList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_01_01/operations/_pricings_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_01_01/operations/_pricings_operations.py index 1592557325b6..c6ef89329d93 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_01_01/operations/_pricings_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_01_01/operations/_pricings_operations.py @@ -19,15 +19,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -202,7 +200,6 @@ def get(self, scope_id: str, pricing_name: str, **kwargs: Any) -> _models.Pricin headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -216,7 +213,7 @@ def get(self, scope_id: str, pricing_name: str, **kwargs: Any) -> _models.Pricin map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("Pricing", pipeline_response) + deserialized = self._deserialize("Pricing", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -339,7 +336,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -353,11 +349,7 @@ def update( 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("Pricing", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("Pricing", pipeline_response) + deserialized = self._deserialize("Pricing", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -403,7 +395,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -461,7 +452,6 @@ def list(self, scope_id: str, filter: Optional[str] = None, **kwargs: Any) -> _m headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -475,7 +465,7 @@ def list(self, scope_id: str, filter: Optional[str] = None, **kwargs: Any) -> _m map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize("PricingList", pipeline_response) + deserialized = self._deserialize("PricingList", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/_metadata.json b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/_metadata.json index 256b1c68a0fd..763d1b227902 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/_metadata.json +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SecurityCenterConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/_security_center.py index 5c07ad7013a3..c86c1e8bf29f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -165,7 +166,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SecurityCenter": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/_vendor.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/_vendor.py +++ /dev/null @@ -1,16 +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 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 diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/_version.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/_version.py index 364f3c906cf9..e5754a47ce68 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/_version.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/_security_center.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/_security_center.py index 0f5b9cee9bc8..0e1171ec6311 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/_security_center.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/_security_center.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -168,7 +169,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SecurityCenter": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_azure_dev_ops_orgs_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_azure_dev_ops_orgs_operations.py index 1b3474a4bbac..9fea4c338df7 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_azure_dev_ops_orgs_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_azure_dev_ops_orgs_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._azure_dev_ops_orgs_operations import ( build_create_or_update_request, build_get_request, @@ -109,7 +109,6 @@ async def list_available( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -124,7 +123,7 @@ async def list_available( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureDevOpsOrgListResponse", pipeline_response) + deserialized = self._deserialize("AzureDevOpsOrgListResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -174,7 +173,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -190,7 +188,6 @@ def prepare_request(next_link=None): _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 @@ -262,7 +259,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -277,7 +273,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response) + deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -291,7 +287,7 @@ async def _create_or_update_initial( org_name: str, azure_dev_ops_org: Union[_models.AzureDevOpsOrg, IO[bytes]], **kwargs: Any - ) -> _models.AzureDevOpsOrg: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -305,7 +301,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AzureDevOpsOrg] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -327,10 +323,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -338,15 +334,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -472,10 +468,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response) + deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -507,7 +504,7 @@ async def _update_initial( org_name: str, azure_dev_ops_org: Union[_models.AzureDevOpsOrg, IO[bytes]], **kwargs: Any - ) -> _models.AzureDevOpsOrg: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -521,7 +518,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AzureDevOpsOrg] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -543,10 +540,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -554,15 +551,15 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -688,10 +685,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response) + deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_azure_dev_ops_projects_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_azure_dev_ops_projects_operations.py index 2542a51cbe32..e9bbf4fc597a 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_azure_dev_ops_projects_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_azure_dev_ops_projects_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._azure_dev_ops_projects_operations import ( build_create_or_update_request, build_get_request, @@ -113,7 +113,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -129,7 +128,6 @@ def prepare_request(next_link=None): _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 @@ -204,7 +202,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -219,7 +216,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureDevOpsProject", pipeline_response) + deserialized = self._deserialize("AzureDevOpsProject", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -234,7 +231,7 @@ async def _create_or_update_initial( project_name: str, azure_dev_ops_project: Union[_models.AzureDevOpsProject, IO[bytes]], **kwargs: Any - ) -> _models.AzureDevOpsProject: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -248,7 +245,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AzureDevOpsProject] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -271,10 +268,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -282,15 +279,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AzureDevOpsProject", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AzureDevOpsProject", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -427,10 +424,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AzureDevOpsProject", pipeline_response) + deserialized = self._deserialize("AzureDevOpsProject", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -463,7 +461,7 @@ async def _update_initial( project_name: str, azure_dev_ops_project: Union[_models.AzureDevOpsProject, IO[bytes]], **kwargs: Any - ) -> _models.AzureDevOpsProject: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -477,7 +475,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AzureDevOpsProject] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -500,10 +498,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -511,15 +509,15 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AzureDevOpsProject", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AzureDevOpsProject", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -656,10 +654,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AzureDevOpsProject", pipeline_response) + deserialized = self._deserialize("AzureDevOpsProject", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_azure_dev_ops_repos_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_azure_dev_ops_repos_operations.py index 32c562b161dd..60493fc44789 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_azure_dev_ops_repos_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_azure_dev_ops_repos_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._azure_dev_ops_repos_operations import ( build_create_or_update_request, build_get_request, @@ -117,7 +117,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -133,7 +132,6 @@ def prepare_request(next_link=None): _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 @@ -217,7 +215,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -232,7 +229,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response) + deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -248,7 +245,7 @@ async def _create_or_update_initial( repo_name: str, azure_dev_ops_repository: Union[_models.AzureDevOpsRepository, IO[bytes]], **kwargs: Any - ) -> _models.AzureDevOpsRepository: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -262,7 +259,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AzureDevOpsRepository] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -286,10 +283,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -297,15 +294,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -452,10 +449,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response) + deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -489,7 +487,7 @@ async def _update_initial( repo_name: str, azure_dev_ops_repository: Union[_models.AzureDevOpsRepository, IO[bytes]], **kwargs: Any - ) -> _models.AzureDevOpsRepository: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -503,7 +501,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AzureDevOpsRepository] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -527,10 +525,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -538,15 +536,15 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -693,10 +691,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response) + deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_dev_ops_configurations_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_dev_ops_configurations_operations.py index a06921b2134b..a905f94deb83 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_dev_ops_configurations_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_dev_ops_configurations_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 @@ -31,7 +32,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._dev_ops_configurations_operations import ( build_create_or_update_request, build_delete_request, @@ -111,7 +111,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -127,7 +126,6 @@ def prepare_request(next_link=None): _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 @@ -196,7 +194,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -211,7 +208,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DevOpsConfiguration", pipeline_response) + deserialized = self._deserialize("DevOpsConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -224,7 +221,7 @@ async def _create_or_update_initial( security_connector_name: str, dev_ops_configuration: Union[_models.DevOpsConfiguration, IO[bytes]], **kwargs: Any - ) -> _models.DevOpsConfiguration: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -238,7 +235,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DevOpsConfiguration] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -259,10 +256,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -270,18 +267,15 @@ async def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DevOpsConfiguration", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("DevOpsConfiguration", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("DevOpsConfiguration", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -398,10 +392,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DevOpsConfiguration", pipeline_response) + deserialized = self._deserialize("DevOpsConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -432,7 +427,7 @@ async def _update_initial( security_connector_name: str, dev_ops_configuration: Union[_models.DevOpsConfiguration, IO[bytes]], **kwargs: Any - ) -> _models.DevOpsConfiguration: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -446,7 +441,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DevOpsConfiguration] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -467,10 +462,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -478,15 +473,15 @@ async def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DevOpsConfiguration", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("DevOpsConfiguration", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -603,10 +598,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DevOpsConfiguration", pipeline_response) + deserialized = self._deserialize("DevOpsConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -631,9 +627,9 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, security_connector_name: str, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -646,7 +642,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -656,10 +652,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -667,12 +663,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -700,7 +704,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, security_connector_name=security_connector_name, api_version=api_version, @@ -709,6 +713,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_dev_ops_operation_results_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_dev_ops_operation_results_operations.py index c4939c8e4cef..29d3f669b542 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_dev_ops_operation_results_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_dev_ops_operation_results_operations.py @@ -18,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 -from ..._vendor import _convert_request from ...operations._dev_ops_operation_results_operations import build_get_request if sys.version_info >= (3, 9): @@ -98,7 +96,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -113,7 +110,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationStatusResult", pipeline_response) + deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_git_hub_owners_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_git_hub_owners_operations.py index 6607bd5ef19b..daf3f4df1946 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_git_hub_owners_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_git_hub_owners_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._git_hub_owners_operations import build_get_request, build_list_available_request, build_list_request if sys.version_info >= (3, 9): @@ -98,7 +96,6 @@ async def list_available( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -113,7 +110,7 @@ async def list_available( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GitHubOwnerListResponse", pipeline_response) + deserialized = self._deserialize("GitHubOwnerListResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -163,7 +160,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -179,7 +175,6 @@ def prepare_request(next_link=None): _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 @@ -251,7 +246,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -266,7 +260,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GitHubOwner", pipeline_response) + deserialized = self._deserialize("GitHubOwner", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_git_hub_repos_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_git_hub_repos_operations.py index 8be9b161275a..848179915329 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_git_hub_repos_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_git_hub_repos_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._git_hub_repos_operations import build_get_request, build_list_request if sys.version_info >= (3, 9): @@ -105,7 +103,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -121,7 +118,6 @@ def prepare_request(next_link=None): _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 @@ -196,7 +192,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -211,7 +206,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GitHubRepository", pipeline_response) + deserialized = self._deserialize("GitHubRepository", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_git_lab_groups_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_git_lab_groups_operations.py index 19aab14fa698..ec1578fed516 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_git_lab_groups_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_git_lab_groups_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._git_lab_groups_operations import build_get_request, build_list_available_request, build_list_request if sys.version_info >= (3, 9): @@ -98,7 +96,6 @@ async def list_available( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -113,7 +110,7 @@ async def list_available( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GitLabGroupListResponse", pipeline_response) + deserialized = self._deserialize("GitLabGroupListResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -163,7 +160,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -179,7 +175,6 @@ def prepare_request(next_link=None): _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 @@ -251,7 +246,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -266,7 +260,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GitLabGroup", pipeline_response) + deserialized = self._deserialize("GitLabGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_git_lab_projects_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_git_lab_projects_operations.py index cd8dd73326b1..b3cf254b9fb8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_git_lab_projects_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_git_lab_projects_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._git_lab_projects_operations import build_get_request, build_list_request if sys.version_info >= (3, 9): @@ -107,7 +105,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -123,7 +120,6 @@ def prepare_request(next_link=None): _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 @@ -205,7 +201,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -220,7 +215,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GitLabProject", pipeline_response) + deserialized = self._deserialize("GitLabProject", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_git_lab_subgroups_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_git_lab_subgroups_operations.py index 2c8e0cc396e2..eeda601a9570 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_git_lab_subgroups_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/aio/operations/_git_lab_subgroups_operations.py @@ -18,14 +18,12 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 -from ..._vendor import _convert_request from ...operations._git_lab_subgroups_operations import build_list_request if sys.version_info >= (3, 9): @@ -98,7 +96,6 @@ async def list( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -113,7 +110,7 @@ async def list( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GitLabGroupListResponse", pipeline_response) + deserialized = self._deserialize("GitLabGroupListResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_azure_dev_ops_orgs_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_azure_dev_ops_orgs_operations.py index 911a2ce7f409..cbcce5469bdd 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_azure_dev_ops_orgs_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_azure_dev_ops_orgs_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,6 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -279,7 +279,6 @@ def list_available( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -294,7 +293,7 @@ def list_available( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureDevOpsOrgListResponse", pipeline_response) + deserialized = self._deserialize("AzureDevOpsOrgListResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -343,7 +342,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -359,7 +357,6 @@ def prepare_request(next_link=None): _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 @@ -431,7 +428,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -446,7 +442,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response) + deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -460,7 +456,7 @@ def _create_or_update_initial( org_name: str, azure_dev_ops_org: Union[_models.AzureDevOpsOrg, IO[bytes]], **kwargs: Any - ) -> _models.AzureDevOpsOrg: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -474,7 +470,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AzureDevOpsOrg] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -496,10 +492,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -507,15 +503,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -638,10 +634,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response) + deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -672,7 +669,7 @@ def _update_initial( org_name: str, azure_dev_ops_org: Union[_models.AzureDevOpsOrg, IO[bytes]], **kwargs: Any - ) -> _models.AzureDevOpsOrg: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -686,7 +683,7 @@ def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AzureDevOpsOrg] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -708,10 +705,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -719,15 +716,15 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -850,10 +847,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response) + deserialized = self._deserialize("AzureDevOpsOrg", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_azure_dev_ops_projects_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_azure_dev_ops_projects_operations.py index 61564504ae63..6c1d3e186835 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_azure_dev_ops_projects_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_azure_dev_ops_projects_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,6 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -270,7 +270,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -286,7 +285,6 @@ def prepare_request(next_link=None): _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 @@ -361,7 +359,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -376,7 +373,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureDevOpsProject", pipeline_response) + deserialized = self._deserialize("AzureDevOpsProject", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -391,7 +388,7 @@ def _create_or_update_initial( project_name: str, azure_dev_ops_project: Union[_models.AzureDevOpsProject, IO[bytes]], **kwargs: Any - ) -> _models.AzureDevOpsProject: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -405,7 +402,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AzureDevOpsProject] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -428,10 +425,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -439,15 +436,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AzureDevOpsProject", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AzureDevOpsProject", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -584,10 +581,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AzureDevOpsProject", pipeline_response) + deserialized = self._deserialize("AzureDevOpsProject", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -619,7 +617,7 @@ def _update_initial( project_name: str, azure_dev_ops_project: Union[_models.AzureDevOpsProject, IO[bytes]], **kwargs: Any - ) -> _models.AzureDevOpsProject: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -633,7 +631,7 @@ def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AzureDevOpsProject] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -656,10 +654,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -667,15 +665,15 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AzureDevOpsProject", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AzureDevOpsProject", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -812,10 +810,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AzureDevOpsProject", pipeline_response) + deserialized = self._deserialize("AzureDevOpsProject", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_azure_dev_ops_repos_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_azure_dev_ops_repos_operations.py index c6f066ecae4a..fae475617d52 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_azure_dev_ops_repos_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_azure_dev_ops_repos_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,6 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -286,7 +286,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -302,7 +301,6 @@ def prepare_request(next_link=None): _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 @@ -386,7 +384,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -401,7 +398,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response) + deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -417,7 +414,7 @@ def _create_or_update_initial( repo_name: str, azure_dev_ops_repository: Union[_models.AzureDevOpsRepository, IO[bytes]], **kwargs: Any - ) -> _models.AzureDevOpsRepository: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -431,7 +428,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AzureDevOpsRepository] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -455,10 +452,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -466,15 +463,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -621,10 +618,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response) + deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -657,7 +655,7 @@ def _update_initial( repo_name: str, azure_dev_ops_repository: Union[_models.AzureDevOpsRepository, IO[bytes]], **kwargs: Any - ) -> _models.AzureDevOpsRepository: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -671,7 +669,7 @@ def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AzureDevOpsRepository] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -695,10 +693,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -706,15 +704,15 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -861,10 +859,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response) + deserialized = self._deserialize("AzureDevOpsRepository", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_dev_ops_configurations_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_dev_ops_configurations_operations.py index 91c14227c528..3c37ec46a9fe 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_dev_ops_configurations_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_dev_ops_configurations_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -31,7 +32,6 @@ from .. import models as _models from ..._serialization import Serializer -from .._vendor import _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -278,7 +278,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -294,7 +293,6 @@ def prepare_request(next_link=None): _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 @@ -361,7 +359,6 @@ def get(self, resource_group_name: str, security_connector_name: str, **kwargs: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -376,7 +373,7 @@ def get(self, resource_group_name: str, security_connector_name: str, **kwargs: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("DevOpsConfiguration", pipeline_response) + deserialized = self._deserialize("DevOpsConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -389,7 +386,7 @@ def _create_or_update_initial( security_connector_name: str, dev_ops_configuration: Union[_models.DevOpsConfiguration, IO[bytes]], **kwargs: Any - ) -> _models.DevOpsConfiguration: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -403,7 +400,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DevOpsConfiguration] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -424,10 +421,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -435,18 +432,15 @@ def _create_or_update_initial( response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DevOpsConfiguration", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("DevOpsConfiguration", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("DevOpsConfiguration", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -563,10 +557,11 @@ def begin_create_or_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DevOpsConfiguration", pipeline_response) + deserialized = self._deserialize("DevOpsConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -596,7 +591,7 @@ def _update_initial( security_connector_name: str, dev_ops_configuration: Union[_models.DevOpsConfiguration, IO[bytes]], **kwargs: Any - ) -> _models.DevOpsConfiguration: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -610,7 +605,7 @@ def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.DevOpsConfiguration] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -631,10 +626,10 @@ def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -642,15 +637,15 @@ def _update_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code == 200: - deserialized = self._deserialize("DevOpsConfiguration", pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize("DevOpsConfiguration", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -767,10 +762,11 @@ def begin_update( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("DevOpsConfiguration", pipeline_response) + deserialized = self._deserialize("DevOpsConfiguration", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -794,9 +790,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, security_connector_name: str, **kwargs: Any - ) -> None: + def _delete_initial(self, resource_group_name: str, security_connector_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -809,7 +803,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( resource_group_name=resource_group_name, @@ -819,10 +813,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -830,12 +824,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: - return cls(pipeline_response, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, security_connector_name: str, **kwargs: Any) -> LROPoller[None]: @@ -861,7 +863,7 @@ def begin_delete(self, resource_group_name: str, security_connector_name: str, * lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, security_connector_name=security_connector_name, api_version=api_version, @@ -870,6 +872,7 @@ def begin_delete(self, resource_group_name: str, security_connector_name: str, * params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_dev_ops_operation_results_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_dev_ops_operation_results_operations.py index b775b0429442..3520e367b384 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_dev_ops_operation_results_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_dev_ops_operation_results_operations.py @@ -18,15 +18,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -139,7 +137,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -154,7 +151,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationStatusResult", pipeline_response) + deserialized = self._deserialize("OperationStatusResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_git_hub_owners_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_git_hub_owners_operations.py index 90ed953a23a3..2ba49b7a4326 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_git_hub_owners_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_git_hub_owners_operations.py @@ -20,15 +20,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -200,7 +198,6 @@ def list_available( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +212,7 @@ def list_available( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GitHubOwnerListResponse", pipeline_response) + deserialized = self._deserialize("GitHubOwnerListResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -264,7 +261,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -280,7 +276,6 @@ def prepare_request(next_link=None): _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 @@ -352,7 +347,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -367,7 +361,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GitHubOwner", pipeline_response) + deserialized = self._deserialize("GitHubOwner", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_git_hub_repos_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_git_hub_repos_operations.py index 0b36941eb900..6782da0801be 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_git_hub_repos_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_git_hub_repos_operations.py @@ -20,15 +20,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -180,7 +178,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -196,7 +193,6 @@ def prepare_request(next_link=None): _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 @@ -271,7 +267,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -286,7 +281,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GitHubRepository", pipeline_response) + deserialized = self._deserialize("GitHubRepository", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_git_lab_groups_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_git_lab_groups_operations.py index 0fb6cc95a8d7..6d6c2856ae8f 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_git_lab_groups_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_git_lab_groups_operations.py @@ -20,15 +20,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -200,7 +198,6 @@ def list_available( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -215,7 +212,7 @@ def list_available( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GitLabGroupListResponse", pipeline_response) + deserialized = self._deserialize("GitLabGroupListResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -264,7 +261,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -280,7 +276,6 @@ def prepare_request(next_link=None): _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 @@ -352,7 +347,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -367,7 +361,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GitLabGroup", pipeline_response) + deserialized = self._deserialize("GitLabGroup", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_git_lab_projects_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_git_lab_projects_operations.py index 2061edd31a4e..ab6a2fd3560c 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_git_lab_projects_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_git_lab_projects_operations.py @@ -20,15 +20,13 @@ ) 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.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -182,7 +180,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -198,7 +195,6 @@ def prepare_request(next_link=None): _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 @@ -280,7 +276,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -295,7 +290,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GitLabProject", pipeline_response) + deserialized = self._deserialize("GitLabProject", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_git_lab_subgroups_operations.py b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_git_lab_subgroups_operations.py index e0bcc2717d60..b9b54b22fba8 100644 --- a/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_git_lab_subgroups_operations.py +++ b/sdk/security/azure-mgmt-security/azure/mgmt/security/v2024_04_01/operations/_git_lab_subgroups_operations.py @@ -18,15 +18,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -135,7 +133,6 @@ def list( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -150,7 +147,7 @@ def list( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GitLabGroupListResponse", pipeline_response) + deserialized = self._deserialize("GitLabGroupListResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/create_or_update_azure_dev_ops_orgs_example.py b/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/create_or_update_azure_dev_ops_orgs_example.py index 9fbbd258177d..16c13efb1fbe 100644 --- a/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/create_or_update_azure_dev_ops_orgs_example.py +++ b/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/create_or_update_azure_dev_ops_orgs_example.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.security import SecurityCenter diff --git a/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/create_or_update_azure_dev_ops_projects_example.py b/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/create_or_update_azure_dev_ops_projects_example.py index 5d3caf1d7e12..0e4ec146b6b2 100644 --- a/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/create_or_update_azure_dev_ops_projects_example.py +++ b/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/create_or_update_azure_dev_ops_projects_example.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.security import SecurityCenter diff --git a/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/create_or_update_azure_dev_ops_repos_example.py b/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/create_or_update_azure_dev_ops_repos_example.py index 6f4330bdb841..911dfc6bd86c 100644 --- a/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/create_or_update_azure_dev_ops_repos_example.py +++ b/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/create_or_update_azure_dev_ops_repos_example.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.security import SecurityCenter diff --git a/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/create_or_update_dev_ops_configurations_onboard_current_and_future_example.py b/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/create_or_update_dev_ops_configurations_onboard_current_and_future_example.py index a57aeebb3030..732537c20170 100644 --- a/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/create_or_update_dev_ops_configurations_onboard_current_and_future_example.py +++ b/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/create_or_update_dev_ops_configurations_onboard_current_and_future_example.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.security import SecurityCenter diff --git a/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/create_or_update_dev_ops_configurations_onboard_current_only_example.py b/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/create_or_update_dev_ops_configurations_onboard_current_only_example.py index 74713ec661fd..07028a78ec55 100644 --- a/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/create_or_update_dev_ops_configurations_onboard_current_only_example.py +++ b/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/create_or_update_dev_ops_configurations_onboard_current_only_example.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.security import SecurityCenter diff --git a/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/create_or_update_dev_ops_configurations_onboard_selected_example.py b/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/create_or_update_dev_ops_configurations_onboard_selected_example.py index 6e3481796ad3..7e524be882b4 100644 --- a/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/create_or_update_dev_ops_configurations_onboard_selected_example.py +++ b/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/create_or_update_dev_ops_configurations_onboard_selected_example.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.security import SecurityCenter diff --git a/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/update_azure_dev_ops_orgs_example.py b/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/update_azure_dev_ops_orgs_example.py index 0b6f93d77d51..bbce72ef3d7e 100644 --- a/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/update_azure_dev_ops_orgs_example.py +++ b/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/update_azure_dev_ops_orgs_example.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.security import SecurityCenter diff --git a/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/update_azure_dev_ops_projects_example.py b/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/update_azure_dev_ops_projects_example.py index 45996194877a..55f46fb1c525 100644 --- a/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/update_azure_dev_ops_projects_example.py +++ b/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/update_azure_dev_ops_projects_example.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.security import SecurityCenter diff --git a/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/update_azure_dev_ops_repos_example.py b/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/update_azure_dev_ops_repos_example.py index f8d6963089ba..00b5a92bc6e3 100644 --- a/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/update_azure_dev_ops_repos_example.py +++ b/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/update_azure_dev_ops_repos_example.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.security import SecurityCenter diff --git a/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/update_dev_ops_configurations_example.py b/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/update_dev_ops_configurations_example.py index 7098b8c472b0..5504e7d57572 100644 --- a/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/update_dev_ops_configurations_example.py +++ b/sdk/security/azure-mgmt-security/generated_samples/security_connectors_dev_ops/update_dev_ops_configurations_example.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.security import SecurityCenter diff --git a/sdk/security/azure-mgmt-security/generated_tests/conftest.py b/sdk/security/azure-mgmt-security/generated_tests/conftest.py new file mode 100644 index 000000000000..d6b0caaad1b6 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_tests/conftest.py @@ -0,0 +1,35 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# aovid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + securitycenter_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") + securitycenter_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + securitycenter_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + securitycenter_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=securitycenter_subscription_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=securitycenter_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=securitycenter_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=securitycenter_client_secret, value="00000000-0000-0000-0000-000000000000") + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/security/azure-mgmt-security/generated_tests/test_security_center_azure_dev_ops_orgs_operations.py b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_azure_dev_ops_orgs_operations.py new file mode 100644 index 000000000000..a95feca0a26c --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_azure_dev_ops_orgs_operations.py @@ -0,0 +1,132 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.security import SecurityCenter + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSecurityCenterAzureDevOpsOrgsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SecurityCenter) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_available(self, resource_group): + response = self.client.azure_dev_ops_orgs.list_available( + resource_group_name=resource_group.name, + security_connector_name="str", + api_version="2024-04-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.azure_dev_ops_orgs.list( + resource_group_name=resource_group.name, + security_connector_name="str", + api_version="2024-04-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.azure_dev_ops_orgs.get( + resource_group_name=resource_group.name, + security_connector_name="str", + org_name="str", + api_version="2024-04-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.azure_dev_ops_orgs.begin_create_or_update( + resource_group_name=resource_group.name, + security_connector_name="str", + org_name="str", + azure_dev_ops_org={ + "id": "str", + "name": "str", + "properties": { + "actionableRemediation": { + "branchConfiguration": {"annotateDefaultBranch": "str", "branchNames": ["str"]}, + "categoryConfigurations": [{"category": "str", "minimumSeverityLevel": "str"}], + "inheritFromParentState": "str", + "state": "str", + }, + "onboardingState": "str", + "provisioningState": "str", + "provisioningStatusMessage": "str", + "provisioningStatusUpdateTimeUtc": "2020-02-20 00:00:00", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-04-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.azure_dev_ops_orgs.begin_update( + resource_group_name=resource_group.name, + security_connector_name="str", + org_name="str", + azure_dev_ops_org={ + "id": "str", + "name": "str", + "properties": { + "actionableRemediation": { + "branchConfiguration": {"annotateDefaultBranch": "str", "branchNames": ["str"]}, + "categoryConfigurations": [{"category": "str", "minimumSeverityLevel": "str"}], + "inheritFromParentState": "str", + "state": "str", + }, + "onboardingState": "str", + "provisioningState": "str", + "provisioningStatusMessage": "str", + "provisioningStatusUpdateTimeUtc": "2020-02-20 00:00:00", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-04-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/security/azure-mgmt-security/generated_tests/test_security_center_azure_dev_ops_orgs_operations_async.py b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_azure_dev_ops_orgs_operations_async.py new file mode 100644 index 000000000000..aed4bd794a7f --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_azure_dev_ops_orgs_operations_async.py @@ -0,0 +1,137 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.security.aio import SecurityCenter + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSecurityCenterAzureDevOpsOrgsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SecurityCenter, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_available(self, resource_group): + response = await self.client.azure_dev_ops_orgs.list_available( + resource_group_name=resource_group.name, + security_connector_name="str", + api_version="2024-04-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.azure_dev_ops_orgs.list( + resource_group_name=resource_group.name, + security_connector_name="str", + api_version="2024-04-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.azure_dev_ops_orgs.get( + resource_group_name=resource_group.name, + security_connector_name="str", + org_name="str", + api_version="2024-04-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.azure_dev_ops_orgs.begin_create_or_update( + resource_group_name=resource_group.name, + security_connector_name="str", + org_name="str", + azure_dev_ops_org={ + "id": "str", + "name": "str", + "properties": { + "actionableRemediation": { + "branchConfiguration": {"annotateDefaultBranch": "str", "branchNames": ["str"]}, + "categoryConfigurations": [{"category": "str", "minimumSeverityLevel": "str"}], + "inheritFromParentState": "str", + "state": "str", + }, + "onboardingState": "str", + "provisioningState": "str", + "provisioningStatusMessage": "str", + "provisioningStatusUpdateTimeUtc": "2020-02-20 00:00:00", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-04-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.azure_dev_ops_orgs.begin_update( + resource_group_name=resource_group.name, + security_connector_name="str", + org_name="str", + azure_dev_ops_org={ + "id": "str", + "name": "str", + "properties": { + "actionableRemediation": { + "branchConfiguration": {"annotateDefaultBranch": "str", "branchNames": ["str"]}, + "categoryConfigurations": [{"category": "str", "minimumSeverityLevel": "str"}], + "inheritFromParentState": "str", + "state": "str", + }, + "onboardingState": "str", + "provisioningState": "str", + "provisioningStatusMessage": "str", + "provisioningStatusUpdateTimeUtc": "2020-02-20 00:00:00", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-04-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/security/azure-mgmt-security/generated_tests/test_security_center_azure_dev_ops_projects_operations.py b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_azure_dev_ops_projects_operations.py new file mode 100644 index 000000000000..82f2c0d05a20 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_azure_dev_ops_projects_operations.py @@ -0,0 +1,128 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.security import SecurityCenter + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSecurityCenterAzureDevOpsProjectsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SecurityCenter) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.azure_dev_ops_projects.list( + resource_group_name=resource_group.name, + security_connector_name="str", + org_name="str", + api_version="2024-04-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.azure_dev_ops_projects.get( + resource_group_name=resource_group.name, + security_connector_name="str", + org_name="str", + project_name="str", + api_version="2024-04-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.azure_dev_ops_projects.begin_create_or_update( + resource_group_name=resource_group.name, + security_connector_name="str", + org_name="str", + project_name="str", + azure_dev_ops_project={ + "id": "str", + "name": "str", + "properties": { + "actionableRemediation": { + "branchConfiguration": {"annotateDefaultBranch": "str", "branchNames": ["str"]}, + "categoryConfigurations": [{"category": "str", "minimumSeverityLevel": "str"}], + "inheritFromParentState": "str", + "state": "str", + }, + "onboardingState": "str", + "parentOrgName": "str", + "projectId": "str", + "provisioningState": "str", + "provisioningStatusMessage": "str", + "provisioningStatusUpdateTimeUtc": "2020-02-20 00:00:00", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-04-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.azure_dev_ops_projects.begin_update( + resource_group_name=resource_group.name, + security_connector_name="str", + org_name="str", + project_name="str", + azure_dev_ops_project={ + "id": "str", + "name": "str", + "properties": { + "actionableRemediation": { + "branchConfiguration": {"annotateDefaultBranch": "str", "branchNames": ["str"]}, + "categoryConfigurations": [{"category": "str", "minimumSeverityLevel": "str"}], + "inheritFromParentState": "str", + "state": "str", + }, + "onboardingState": "str", + "parentOrgName": "str", + "projectId": "str", + "provisioningState": "str", + "provisioningStatusMessage": "str", + "provisioningStatusUpdateTimeUtc": "2020-02-20 00:00:00", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-04-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/security/azure-mgmt-security/generated_tests/test_security_center_azure_dev_ops_projects_operations_async.py b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_azure_dev_ops_projects_operations_async.py new file mode 100644 index 000000000000..300c0556fad3 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_azure_dev_ops_projects_operations_async.py @@ -0,0 +1,133 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.security.aio import SecurityCenter + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSecurityCenterAzureDevOpsProjectsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SecurityCenter, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.azure_dev_ops_projects.list( + resource_group_name=resource_group.name, + security_connector_name="str", + org_name="str", + api_version="2024-04-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.azure_dev_ops_projects.get( + resource_group_name=resource_group.name, + security_connector_name="str", + org_name="str", + project_name="str", + api_version="2024-04-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.azure_dev_ops_projects.begin_create_or_update( + resource_group_name=resource_group.name, + security_connector_name="str", + org_name="str", + project_name="str", + azure_dev_ops_project={ + "id": "str", + "name": "str", + "properties": { + "actionableRemediation": { + "branchConfiguration": {"annotateDefaultBranch": "str", "branchNames": ["str"]}, + "categoryConfigurations": [{"category": "str", "minimumSeverityLevel": "str"}], + "inheritFromParentState": "str", + "state": "str", + }, + "onboardingState": "str", + "parentOrgName": "str", + "projectId": "str", + "provisioningState": "str", + "provisioningStatusMessage": "str", + "provisioningStatusUpdateTimeUtc": "2020-02-20 00:00:00", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-04-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.azure_dev_ops_projects.begin_update( + resource_group_name=resource_group.name, + security_connector_name="str", + org_name="str", + project_name="str", + azure_dev_ops_project={ + "id": "str", + "name": "str", + "properties": { + "actionableRemediation": { + "branchConfiguration": {"annotateDefaultBranch": "str", "branchNames": ["str"]}, + "categoryConfigurations": [{"category": "str", "minimumSeverityLevel": "str"}], + "inheritFromParentState": "str", + "state": "str", + }, + "onboardingState": "str", + "parentOrgName": "str", + "projectId": "str", + "provisioningState": "str", + "provisioningStatusMessage": "str", + "provisioningStatusUpdateTimeUtc": "2020-02-20 00:00:00", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-04-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/security/azure-mgmt-security/generated_tests/test_security_center_azure_dev_ops_repos_operations.py b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_azure_dev_ops_repos_operations.py new file mode 100644 index 000000000000..5d31a96dc46d --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_azure_dev_ops_repos_operations.py @@ -0,0 +1,138 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.security import SecurityCenter + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSecurityCenterAzureDevOpsReposOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SecurityCenter) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.azure_dev_ops_repos.list( + resource_group_name=resource_group.name, + security_connector_name="str", + org_name="str", + project_name="str", + api_version="2024-04-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.azure_dev_ops_repos.get( + resource_group_name=resource_group.name, + security_connector_name="str", + org_name="str", + project_name="str", + repo_name="str", + api_version="2024-04-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.azure_dev_ops_repos.begin_create_or_update( + resource_group_name=resource_group.name, + security_connector_name="str", + org_name="str", + project_name="str", + repo_name="str", + azure_dev_ops_repository={ + "id": "str", + "name": "str", + "properties": { + "actionableRemediation": { + "branchConfiguration": {"annotateDefaultBranch": "str", "branchNames": ["str"]}, + "categoryConfigurations": [{"category": "str", "minimumSeverityLevel": "str"}], + "inheritFromParentState": "str", + "state": "str", + }, + "onboardingState": "str", + "parentOrgName": "str", + "parentProjectName": "str", + "provisioningState": "str", + "provisioningStatusMessage": "str", + "provisioningStatusUpdateTimeUtc": "2020-02-20 00:00:00", + "repoId": "str", + "repoUrl": "str", + "visibility": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-04-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.azure_dev_ops_repos.begin_update( + resource_group_name=resource_group.name, + security_connector_name="str", + org_name="str", + project_name="str", + repo_name="str", + azure_dev_ops_repository={ + "id": "str", + "name": "str", + "properties": { + "actionableRemediation": { + "branchConfiguration": {"annotateDefaultBranch": "str", "branchNames": ["str"]}, + "categoryConfigurations": [{"category": "str", "minimumSeverityLevel": "str"}], + "inheritFromParentState": "str", + "state": "str", + }, + "onboardingState": "str", + "parentOrgName": "str", + "parentProjectName": "str", + "provisioningState": "str", + "provisioningStatusMessage": "str", + "provisioningStatusUpdateTimeUtc": "2020-02-20 00:00:00", + "repoId": "str", + "repoUrl": "str", + "visibility": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-04-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/security/azure-mgmt-security/generated_tests/test_security_center_azure_dev_ops_repos_operations_async.py b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_azure_dev_ops_repos_operations_async.py new file mode 100644 index 000000000000..dd6c67e82894 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_azure_dev_ops_repos_operations_async.py @@ -0,0 +1,143 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.security.aio import SecurityCenter + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSecurityCenterAzureDevOpsReposOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SecurityCenter, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.azure_dev_ops_repos.list( + resource_group_name=resource_group.name, + security_connector_name="str", + org_name="str", + project_name="str", + api_version="2024-04-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.azure_dev_ops_repos.get( + resource_group_name=resource_group.name, + security_connector_name="str", + org_name="str", + project_name="str", + repo_name="str", + api_version="2024-04-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.azure_dev_ops_repos.begin_create_or_update( + resource_group_name=resource_group.name, + security_connector_name="str", + org_name="str", + project_name="str", + repo_name="str", + azure_dev_ops_repository={ + "id": "str", + "name": "str", + "properties": { + "actionableRemediation": { + "branchConfiguration": {"annotateDefaultBranch": "str", "branchNames": ["str"]}, + "categoryConfigurations": [{"category": "str", "minimumSeverityLevel": "str"}], + "inheritFromParentState": "str", + "state": "str", + }, + "onboardingState": "str", + "parentOrgName": "str", + "parentProjectName": "str", + "provisioningState": "str", + "provisioningStatusMessage": "str", + "provisioningStatusUpdateTimeUtc": "2020-02-20 00:00:00", + "repoId": "str", + "repoUrl": "str", + "visibility": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-04-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.azure_dev_ops_repos.begin_update( + resource_group_name=resource_group.name, + security_connector_name="str", + org_name="str", + project_name="str", + repo_name="str", + azure_dev_ops_repository={ + "id": "str", + "name": "str", + "properties": { + "actionableRemediation": { + "branchConfiguration": {"annotateDefaultBranch": "str", "branchNames": ["str"]}, + "categoryConfigurations": [{"category": "str", "minimumSeverityLevel": "str"}], + "inheritFromParentState": "str", + "state": "str", + }, + "onboardingState": "str", + "parentOrgName": "str", + "parentProjectName": "str", + "provisioningState": "str", + "provisioningStatusMessage": "str", + "provisioningStatusUpdateTimeUtc": "2020-02-20 00:00:00", + "repoId": "str", + "repoUrl": "str", + "visibility": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-04-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/security/azure-mgmt-security/generated_tests/test_security_center_dev_ops_configurations_operations.py b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_dev_ops_configurations_operations.py new file mode 100644 index 000000000000..a21fc3e4ab41 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_dev_ops_configurations_operations.py @@ -0,0 +1,123 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.security import SecurityCenter + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSecurityCenterDevOpsConfigurationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SecurityCenter) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.dev_ops_configurations.list( + resource_group_name=resource_group.name, + security_connector_name="str", + api_version="2024-04-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.dev_ops_configurations.get( + resource_group_name=resource_group.name, + security_connector_name="str", + api_version="2024-04-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.dev_ops_configurations.begin_create_or_update( + resource_group_name=resource_group.name, + security_connector_name="str", + dev_ops_configuration={ + "id": "str", + "name": "str", + "properties": { + "authorization": {"code": "str"}, + "autoDiscovery": "str", + "capabilities": [{"name": "str", "value": "str"}], + "provisioningState": "str", + "provisioningStatusMessage": "str", + "provisioningStatusUpdateTimeUtc": "2020-02-20 00:00:00", + "topLevelInventoryList": ["str"], + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-04-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.dev_ops_configurations.begin_update( + resource_group_name=resource_group.name, + security_connector_name="str", + dev_ops_configuration={ + "id": "str", + "name": "str", + "properties": { + "authorization": {"code": "str"}, + "autoDiscovery": "str", + "capabilities": [{"name": "str", "value": "str"}], + "provisioningState": "str", + "provisioningStatusMessage": "str", + "provisioningStatusUpdateTimeUtc": "2020-02-20 00:00:00", + "topLevelInventoryList": ["str"], + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-04-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.dev_ops_configurations.begin_delete( + resource_group_name=resource_group.name, + security_connector_name="str", + api_version="2024-04-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/security/azure-mgmt-security/generated_tests/test_security_center_dev_ops_configurations_operations_async.py b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_dev_ops_configurations_operations_async.py new file mode 100644 index 000000000000..23dfe7415fc9 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_dev_ops_configurations_operations_async.py @@ -0,0 +1,130 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.security.aio import SecurityCenter + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSecurityCenterDevOpsConfigurationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SecurityCenter, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.dev_ops_configurations.list( + resource_group_name=resource_group.name, + security_connector_name="str", + api_version="2024-04-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.dev_ops_configurations.get( + resource_group_name=resource_group.name, + security_connector_name="str", + api_version="2024-04-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.dev_ops_configurations.begin_create_or_update( + resource_group_name=resource_group.name, + security_connector_name="str", + dev_ops_configuration={ + "id": "str", + "name": "str", + "properties": { + "authorization": {"code": "str"}, + "autoDiscovery": "str", + "capabilities": [{"name": "str", "value": "str"}], + "provisioningState": "str", + "provisioningStatusMessage": "str", + "provisioningStatusUpdateTimeUtc": "2020-02-20 00:00:00", + "topLevelInventoryList": ["str"], + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-04-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.dev_ops_configurations.begin_update( + resource_group_name=resource_group.name, + security_connector_name="str", + dev_ops_configuration={ + "id": "str", + "name": "str", + "properties": { + "authorization": {"code": "str"}, + "autoDiscovery": "str", + "capabilities": [{"name": "str", "value": "str"}], + "provisioningState": "str", + "provisioningStatusMessage": "str", + "provisioningStatusUpdateTimeUtc": "2020-02-20 00:00:00", + "topLevelInventoryList": ["str"], + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-04-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.dev_ops_configurations.begin_delete( + resource_group_name=resource_group.name, + security_connector_name="str", + api_version="2024-04-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/security/azure-mgmt-security/generated_tests/test_security_center_dev_ops_operation_results_operations.py b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_dev_ops_operation_results_operations.py new file mode 100644 index 000000000000..2e0e61b1216a --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_dev_ops_operation_results_operations.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.security import SecurityCenter + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSecurityCenterDevOpsOperationResultsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SecurityCenter) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.dev_ops_operation_results.get( + resource_group_name=resource_group.name, + security_connector_name="str", + operation_result_id="str", + api_version="2024-04-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/security/azure-mgmt-security/generated_tests/test_security_center_dev_ops_operation_results_operations_async.py b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_dev_ops_operation_results_operations_async.py new file mode 100644 index 000000000000..b45fbec5eb1d --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_dev_ops_operation_results_operations_async.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.security.aio import SecurityCenter + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSecurityCenterDevOpsOperationResultsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SecurityCenter, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.dev_ops_operation_results.get( + resource_group_name=resource_group.name, + security_connector_name="str", + operation_result_id="str", + api_version="2024-04-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/security/azure-mgmt-security/generated_tests/test_security_center_git_hub_owners_operations.py b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_git_hub_owners_operations.py new file mode 100644 index 000000000000..4b583882057a --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_git_hub_owners_operations.py @@ -0,0 +1,56 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.security import SecurityCenter + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSecurityCenterGitHubOwnersOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SecurityCenter) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_available(self, resource_group): + response = self.client.git_hub_owners.list_available( + resource_group_name=resource_group.name, + security_connector_name="str", + api_version="2024-04-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.git_hub_owners.list( + resource_group_name=resource_group.name, + security_connector_name="str", + api_version="2024-04-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.git_hub_owners.get( + resource_group_name=resource_group.name, + security_connector_name="str", + owner_name="str", + api_version="2024-04-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/security/azure-mgmt-security/generated_tests/test_security_center_git_hub_owners_operations_async.py b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_git_hub_owners_operations_async.py new file mode 100644 index 000000000000..9fdd26378f62 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_git_hub_owners_operations_async.py @@ -0,0 +1,57 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.security.aio import SecurityCenter + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSecurityCenterGitHubOwnersOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SecurityCenter, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_available(self, resource_group): + response = await self.client.git_hub_owners.list_available( + resource_group_name=resource_group.name, + security_connector_name="str", + api_version="2024-04-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.git_hub_owners.list( + resource_group_name=resource_group.name, + security_connector_name="str", + api_version="2024-04-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.git_hub_owners.get( + resource_group_name=resource_group.name, + security_connector_name="str", + owner_name="str", + api_version="2024-04-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/security/azure-mgmt-security/generated_tests/test_security_center_git_hub_repos_operations.py b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_git_hub_repos_operations.py new file mode 100644 index 000000000000..432005804920 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_git_hub_repos_operations.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.security import SecurityCenter + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSecurityCenterGitHubReposOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SecurityCenter) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.git_hub_repos.list( + resource_group_name=resource_group.name, + security_connector_name="str", + owner_name="str", + api_version="2024-04-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.git_hub_repos.get( + resource_group_name=resource_group.name, + security_connector_name="str", + owner_name="str", + repo_name="str", + api_version="2024-04-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/security/azure-mgmt-security/generated_tests/test_security_center_git_hub_repos_operations_async.py b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_git_hub_repos_operations_async.py new file mode 100644 index 000000000000..b36031c6abc8 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_git_hub_repos_operations_async.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.security.aio import SecurityCenter + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSecurityCenterGitHubReposOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SecurityCenter, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.git_hub_repos.list( + resource_group_name=resource_group.name, + security_connector_name="str", + owner_name="str", + api_version="2024-04-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.git_hub_repos.get( + resource_group_name=resource_group.name, + security_connector_name="str", + owner_name="str", + repo_name="str", + api_version="2024-04-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/security/azure-mgmt-security/generated_tests/test_security_center_git_lab_groups_operations.py b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_git_lab_groups_operations.py new file mode 100644 index 000000000000..4ab46b427dde --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_git_lab_groups_operations.py @@ -0,0 +1,56 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.security import SecurityCenter + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSecurityCenterGitLabGroupsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SecurityCenter) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_available(self, resource_group): + response = self.client.git_lab_groups.list_available( + resource_group_name=resource_group.name, + security_connector_name="str", + api_version="2024-04-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.git_lab_groups.list( + resource_group_name=resource_group.name, + security_connector_name="str", + api_version="2024-04-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.git_lab_groups.get( + resource_group_name=resource_group.name, + security_connector_name="str", + group_fq_name="str", + api_version="2024-04-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/security/azure-mgmt-security/generated_tests/test_security_center_git_lab_groups_operations_async.py b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_git_lab_groups_operations_async.py new file mode 100644 index 000000000000..d28da94de718 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_git_lab_groups_operations_async.py @@ -0,0 +1,57 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.security.aio import SecurityCenter + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSecurityCenterGitLabGroupsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SecurityCenter, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_available(self, resource_group): + response = await self.client.git_lab_groups.list_available( + resource_group_name=resource_group.name, + security_connector_name="str", + api_version="2024-04-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.git_lab_groups.list( + resource_group_name=resource_group.name, + security_connector_name="str", + api_version="2024-04-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.git_lab_groups.get( + resource_group_name=resource_group.name, + security_connector_name="str", + group_fq_name="str", + api_version="2024-04-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/security/azure-mgmt-security/generated_tests/test_security_center_git_lab_projects_operations.py b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_git_lab_projects_operations.py new file mode 100644 index 000000000000..c30aa262b7f3 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_git_lab_projects_operations.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.security import SecurityCenter + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSecurityCenterGitLabProjectsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SecurityCenter) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.git_lab_projects.list( + resource_group_name=resource_group.name, + security_connector_name="str", + group_fq_name="str", + api_version="2024-04-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.git_lab_projects.get( + resource_group_name=resource_group.name, + security_connector_name="str", + group_fq_name="str", + project_name="str", + api_version="2024-04-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/security/azure-mgmt-security/generated_tests/test_security_center_git_lab_projects_operations_async.py b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_git_lab_projects_operations_async.py new file mode 100644 index 000000000000..4ba461b02ea1 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_git_lab_projects_operations_async.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.security.aio import SecurityCenter + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSecurityCenterGitLabProjectsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SecurityCenter, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.git_lab_projects.list( + resource_group_name=resource_group.name, + security_connector_name="str", + group_fq_name="str", + api_version="2024-04-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.git_lab_projects.get( + resource_group_name=resource_group.name, + security_connector_name="str", + group_fq_name="str", + project_name="str", + api_version="2024-04-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/security/azure-mgmt-security/generated_tests/test_security_center_git_lab_subgroups_operations.py b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_git_lab_subgroups_operations.py new file mode 100644 index 000000000000..e66e29f77d1d --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_git_lab_subgroups_operations.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.security import SecurityCenter + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSecurityCenterGitLabSubgroupsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SecurityCenter) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.git_lab_subgroups.list( + resource_group_name=resource_group.name, + security_connector_name="str", + group_fq_name="str", + api_version="2024-04-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/security/azure-mgmt-security/generated_tests/test_security_center_git_lab_subgroups_operations_async.py b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_git_lab_subgroups_operations_async.py new file mode 100644 index 000000000000..9e2e2f5d61d0 --- /dev/null +++ b/sdk/security/azure-mgmt-security/generated_tests/test_security_center_git_lab_subgroups_operations_async.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.security.aio import SecurityCenter + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSecurityCenterGitLabSubgroupsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SecurityCenter, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = await self.client.git_lab_subgroups.list( + resource_group_name=resource_group.name, + security_connector_name="str", + group_fq_name="str", + api_version="2024-04-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/security/azure-mgmt-security/setup.py b/sdk/security/azure-mgmt-security/setup.py index 15b3b6e1bc8b..ac97407fc4ef 100644 --- a/sdk/security/azure-mgmt-security/setup.py +++ b/sdk/security/azure-mgmt-security/setup.py @@ -75,6 +75,7 @@ }, install_requires=[ "isodate>=0.6.1", + "typing-extensions>=4.6.0", "azure-common>=1.1", "azure-mgmt-core>=1.3.2", ],