diff --git a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/_meta.json b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/_meta.json index 87aaa163f434..16cf8e0889be 100644 --- a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/_meta.json +++ b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/_meta.json @@ -1,11 +1,11 @@ { - "commit": "43f10d3b8bacd5fc6b01254b5050c613f26c3573", - "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "commit": "bc35ae3b67f3c1ed5ca85817337647bfd89f92c8", + "repository_url": "https://github.com/test-repo-billy/azure-rest-api-specs", "autorest": "3.10.2", "use": [ - "@autorest/python@6.13.19", + "@autorest/python@6.17.0", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/appcomplianceautomation/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.19 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "autorest_command": "autorest specification/appcomplianceautomation/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.17.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/appcomplianceautomation/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/_app_compliance_automation_mgmt_client.py b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/_app_compliance_automation_mgmt_client.py index bc62f5383303..2687e8b21d3b 100644 --- a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/_app_compliance_automation_mgmt_client.py +++ b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/_app_compliance_automation_mgmt_client.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 @@ -127,7 +128,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "AppComplianceAutomationMgmtClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/_serialization.py b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/_serialization.py index f0c6180722c8..8139854b97bb 100644 --- a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/_serialization.py +++ b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/_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 diff --git a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/_vendor.py b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/_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/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/_version.py b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/_version.py index c47f66669f1b..e5754a47ce68 100644 --- a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/_version.py +++ b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/aio/_app_compliance_automation_mgmt_client.py b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/aio/_app_compliance_automation_mgmt_client.py index a98996476101..3cd900f21574 100644 --- a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/aio/_app_compliance_automation_mgmt_client.py +++ b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/aio/_app_compliance_automation_mgmt_client.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 @@ -129,7 +130,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "AppComplianceAutomationMgmtClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/aio/operations/_evidence_operations.py b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/aio/operations/_evidence_operations.py index 1d24d65e6fd3..95bfd37df3f1 100644 --- a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/aio/operations/_evidence_operations.py +++ b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/aio/operations/_evidence_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._evidence_operations import ( build_create_or_update_request, build_delete_request, @@ -132,7 +130,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -148,7 +145,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 @@ -211,7 +207,6 @@ async def get(self, report_name: str, evidence_name: str, **kwargs: Any) -> _mod headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -226,7 +221,7 @@ async def get(self, report_name: str, evidence_name: str, **kwargs: Any) -> _mod error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EvidenceResource", pipeline_response) + deserialized = self._deserialize("EvidenceResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -359,7 +354,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -374,11 +368,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("EvidenceResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EvidenceResource", pipeline_response) + deserialized = self._deserialize("EvidenceResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -420,7 +410,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 @@ -544,7 +533,6 @@ async def download( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -559,7 +547,7 @@ async def download( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EvidenceFileDownloadResponse", pipeline_response) + deserialized = self._deserialize("EvidenceFileDownloadResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/aio/operations/_operations.py b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/aio/operations/_operations.py index 51d11b449cdc..c67289d21b28 100644 --- a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/aio/operations/_operations.py +++ b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/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): @@ -88,7 +86,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -104,7 +101,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/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/aio/operations/_provider_actions_operations.py b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/aio/operations/_provider_actions_operations.py index 44c7536572ae..c7ac3bb714fe 100644 --- a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/aio/operations/_provider_actions_operations.py +++ b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/aio/operations/_provider_actions_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,19 +16,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._provider_actions_operations import ( build_check_name_availability_request, build_get_collection_count_request, @@ -142,7 +142,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -157,7 +156,7 @@ async def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -240,7 +239,6 @@ async def get_collection_count( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -255,7 +253,7 @@ async def get_collection_count( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GetCollectionCountResponse", pipeline_response) + deserialized = self._deserialize("GetCollectionCountResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -338,7 +336,6 @@ async def get_overview_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -353,7 +350,7 @@ async def get_overview_status( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GetOverviewStatusResponse", pipeline_response) + deserialized = self._deserialize("GetOverviewStatusResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -437,7 +434,6 @@ async def list_in_use_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -452,7 +448,7 @@ async def list_in_use_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListInUseStorageAccountsResponse", pipeline_response) + deserialized = self._deserialize("ListInUseStorageAccountsResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -461,7 +457,7 @@ async def list_in_use_storage_accounts( async def _onboard_initial( self, body: Union[_models.OnboardRequest, IO[bytes]], **kwargs: Any - ) -> Optional[_models.OnboardResponse]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -475,7 +471,7 @@ async def _onboard_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.OnboardResponse]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -493,10 +489,10 @@ async def _onboard_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 ) @@ -504,19 +500,21 @@ async def _onboard_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) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("OnboardResponse", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -592,10 +590,11 @@ async def begin_onboard( 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("OnboardResponse", pipeline_response) + deserialized = self._deserialize("OnboardResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -621,7 +620,7 @@ def get_long_running_output(pipeline_response): async def _trigger_evaluation_initial( self, body: Union[_models.TriggerEvaluationRequest, IO[bytes]], **kwargs: Any - ) -> Optional[_models.TriggerEvaluationResponse]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -635,7 +634,7 @@ async def _trigger_evaluation_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.TriggerEvaluationResponse]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -653,10 +652,10 @@ async def _trigger_evaluation_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 ) @@ -664,19 +663,21 @@ async def _trigger_evaluation_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) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("TriggerEvaluationResponse", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -752,10 +753,11 @@ async def begin_trigger_evaluation( 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("TriggerEvaluationResponse", pipeline_response) + deserialized = self._deserialize("TriggerEvaluationResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/aio/operations/_report_operations.py b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/aio/operations/_report_operations.py index bb2971ed2658..9259c5458148 100644 --- a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/aio/operations/_report_operations.py +++ b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/aio/operations/_report_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._report_operations import ( build_create_or_update_request, build_delete_request, @@ -135,7 +135,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -151,7 +150,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 @@ -211,7 +209,6 @@ async def get(self, report_name: str, **kwargs: Any) -> _models.ReportResource: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -226,7 +223,7 @@ async def get(self, report_name: str, **kwargs: Any) -> _models.ReportResource: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ReportResource", pipeline_response) + deserialized = self._deserialize("ReportResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -235,7 +232,7 @@ async def get(self, report_name: str, **kwargs: Any) -> _models.ReportResource: async def _create_or_update_initial( self, report_name: str, properties: Union[_models.ReportResource, IO[bytes]], **kwargs: Any - ) -> _models.ReportResource: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -249,7 +246,7 @@ async def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ReportResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -268,10 +265,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 ) @@ -279,18 +276,19 @@ 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) response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ReportResource", pipeline_response) - if response.status_code == 201: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = self._deserialize("ReportResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -382,10 +380,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("ReportResource", pipeline_response) + deserialized = self._deserialize("ReportResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -412,7 +411,7 @@ def get_long_running_output(pipeline_response): async def _update_initial( self, report_name: str, properties: Union[_models.ReportResourcePatch, IO[bytes]], **kwargs: Any - ) -> Optional[_models.ReportResource]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -426,7 +425,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.ReportResource]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -445,10 +444,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 ) @@ -456,19 +455,21 @@ 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) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ReportResource", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -556,10 +557,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("ReportResource", pipeline_response) + deserialized = self._deserialize("ReportResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -583,9 +585,7 @@ 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 - self, report_name: str, **kwargs: Any - ) -> None: + async def _delete_initial(self, report_name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -598,7 +598,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._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( report_name=report_name, @@ -606,10 +606,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 ) @@ -617,6 +617,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [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) @@ -626,8 +630,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + 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, report_name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -648,7 +656,7 @@ async def begin_delete(self, report_name: str, **kwargs: Any) -> AsyncLROPoller[ 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( report_name=report_name, api_version=api_version, cls=lambda x, y, z: x, @@ -656,6 +664,7 @@ async def begin_delete(self, report_name: str, **kwargs: Any) -> AsyncLROPoller[ 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 @@ -768,7 +777,6 @@ async def nested_resource_check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -783,14 +791,14 @@ async def nested_resource_check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - async def _fix_initial(self, report_name: str, **kwargs: Any) -> Optional[_models.ReportFixResult]: + async def _fix_initial(self, report_name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -803,7 +811,7 @@ async def _fix_initial(self, report_name: str, **kwargs: Any) -> Optional[_model _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.ReportFixResult]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_fix_request( report_name=report_name, @@ -811,10 +819,10 @@ async def _fix_initial(self, report_name: str, **kwargs: Any) -> Optional[_model 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 ) @@ -822,19 +830,21 @@ async def _fix_initial(self, report_name: str, **kwargs: Any) -> Optional[_model 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) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ReportFixResult", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -870,10 +880,11 @@ async def begin_fix(self, report_name: str, **kwargs: Any) -> AsyncLROPoller[_mo 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("ReportFixResult", pipeline_response) + deserialized = self._deserialize("ReportFixResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -928,7 +939,6 @@ async def get_scoping_questions(self, report_name: str, **kwargs: Any) -> _model headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -943,7 +953,7 @@ async def get_scoping_questions(self, report_name: str, **kwargs: Any) -> _model error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ScopingQuestions", pipeline_response) + deserialized = self._deserialize("ScopingQuestions", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -952,7 +962,7 @@ async def get_scoping_questions(self, report_name: str, **kwargs: Any) -> _model async def _sync_cert_record_initial( self, report_name: str, body: Union[_models.SyncCertRecordRequest, IO[bytes]], **kwargs: Any - ) -> Optional[_models.SyncCertRecordResponse]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -966,7 +976,7 @@ async def _sync_cert_record_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.SyncCertRecordResponse]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -985,10 +995,10 @@ async def _sync_cert_record_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 ) @@ -996,19 +1006,21 @@ async def _sync_cert_record_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) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("SyncCertRecordResponse", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1096,10 +1108,11 @@ async def begin_sync_cert_record( 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("SyncCertRecordResponse", pipeline_response) + deserialized = self._deserialize("SyncCertRecordResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1123,7 +1136,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _verify_initial(self, report_name: str, **kwargs: Any) -> Optional[_models.ReportVerificationResult]: + async def _verify_initial(self, report_name: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1136,7 +1149,7 @@ async def _verify_initial(self, report_name: str, **kwargs: Any) -> Optional[_mo _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.ReportVerificationResult]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_verify_request( report_name=report_name, @@ -1144,10 +1157,10 @@ async def _verify_initial(self, report_name: str, **kwargs: Any) -> Optional[_mo 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 ) @@ -1155,19 +1168,21 @@ async def _verify_initial(self, report_name: str, **kwargs: Any) -> Optional[_mo 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) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ReportVerificationResult", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1202,10 +1217,11 @@ async def begin_verify(self, report_name: str, **kwargs: Any) -> AsyncLROPoller[ 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("ReportVerificationResult", pipeline_response) + deserialized = self._deserialize("ReportVerificationResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/aio/operations/_scoping_configuration_operations.py b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/aio/operations/_scoping_configuration_operations.py index 38eae06feabb..dd495500f016 100644 --- a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/aio/operations/_scoping_configuration_operations.py +++ b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/aio/operations/_scoping_configuration_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._scoping_configuration_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 @@ -195,7 +190,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("ScopingConfigurationResource", pipeline_response) + deserialized = self._deserialize("ScopingConfigurationResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -312,7 +307,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -327,11 +321,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("ScopingConfigurationResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ScopingConfigurationResource", pipeline_response) + deserialized = self._deserialize("ScopingConfigurationResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -373,7 +363,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/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/aio/operations/_snapshot_operations.py b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/aio/operations/_snapshot_operations.py index d09f74cd9e97..984a82a02de5 100644 --- a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/aio/operations/_snapshot_operations.py +++ b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/aio/operations/_snapshot_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._snapshot_operations import build_download_request, build_get_request, build_list_request if sys.version_info >= (3, 9): @@ -128,7 +128,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -144,7 +143,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 @@ -207,7 +205,6 @@ async def get(self, report_name: str, snapshot_name: str, **kwargs: Any) -> _mod headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -222,7 +219,7 @@ async def get(self, report_name: str, snapshot_name: str, **kwargs: Any) -> _mod error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SnapshotResource", pipeline_response) + deserialized = self._deserialize("SnapshotResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -235,7 +232,7 @@ async def _download_initial( snapshot_name: str, body: Union[_models.SnapshotDownloadRequest, IO[bytes]], **kwargs: Any - ) -> Optional[_models.DownloadResponse]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -249,7 +246,7 @@ async def _download_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.DownloadResponse]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -269,10 +266,10 @@ async def _download_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 ) @@ -280,19 +277,21 @@ async def _download_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) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("DownloadResponse", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -398,10 +397,11 @@ async def begin_download( 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("DownloadResponse", pipeline_response) + deserialized = self._deserialize("DownloadResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/aio/operations/_webhook_operations.py b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/aio/operations/_webhook_operations.py index e204e2a6f9db..22a7b06fa193 100644 --- a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/aio/operations/_webhook_operations.py +++ b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/aio/operations/_webhook_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._webhook_operations import ( build_create_or_update_request, build_delete_request, @@ -132,7 +130,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -148,7 +145,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 @@ -211,7 +207,6 @@ async def get(self, report_name: str, webhook_name: str, **kwargs: Any) -> _mode headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -226,7 +221,7 @@ async def get(self, report_name: str, webhook_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("WebhookResource", pipeline_response) + deserialized = self._deserialize("WebhookResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -338,7 +333,6 @@ async def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -353,11 +347,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("WebhookResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("WebhookResource", pipeline_response) + deserialized = self._deserialize("WebhookResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -470,7 +460,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -485,7 +474,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebhookResource", pipeline_response) + deserialized = self._deserialize("WebhookResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -527,7 +516,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/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/operations/_evidence_operations.py b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/operations/_evidence_operations.py index 0d94b41ca64b..58028588cbde 100644 --- a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/operations/_evidence_operations.py +++ b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/operations/_evidence_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 @@ -307,7 +305,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -323,7 +320,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 +382,6 @@ def get(self, report_name: str, evidence_name: str, **kwargs: Any) -> _models.Ev headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -401,7 +396,7 @@ def get(self, report_name: str, evidence_name: str, **kwargs: Any) -> _models.Ev error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EvidenceResource", pipeline_response) + deserialized = self._deserialize("EvidenceResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -534,7 +529,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -549,11 +543,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("EvidenceResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("EvidenceResource", pipeline_response) + deserialized = self._deserialize("EvidenceResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -595,7 +585,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 @@ -719,7 +708,6 @@ def download( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -734,7 +722,7 @@ def download( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("EvidenceFileDownloadResponse", pipeline_response) + deserialized = self._deserialize("EvidenceFileDownloadResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/operations/_operations.py b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/operations/_operations.py index 9ba9dcd4e347..1a203bf93667 100644 --- a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/operations/_operations.py +++ b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/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 @@ -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 diff --git a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/operations/_provider_actions_operations.py b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/operations/_provider_actions_operations.py index f9dc9131c2f2..ede25fff8045 100644 --- a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/operations/_provider_actions_operations.py +++ b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/operations/_provider_actions_operations.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,12 +16,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 @@ -29,7 +30,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 check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -285,7 +284,7 @@ def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -368,7 +367,6 @@ def get_collection_count( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -383,7 +381,7 @@ def get_collection_count( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GetCollectionCountResponse", pipeline_response) + deserialized = self._deserialize("GetCollectionCountResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -466,7 +464,6 @@ def get_overview_status( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -481,7 +478,7 @@ def get_overview_status( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GetOverviewStatusResponse", pipeline_response) + deserialized = self._deserialize("GetOverviewStatusResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -565,7 +562,6 @@ def list_in_use_storage_accounts( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -580,16 +576,14 @@ def list_in_use_storage_accounts( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ListInUseStorageAccountsResponse", pipeline_response) + deserialized = self._deserialize("ListInUseStorageAccountsResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _onboard_initial( - self, body: Union[_models.OnboardRequest, IO[bytes]], **kwargs: Any - ) -> Optional[_models.OnboardResponse]: + def _onboard_initial(self, body: Union[_models.OnboardRequest, IO[bytes]], **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -603,7 +597,7 @@ def _onboard_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.OnboardResponse]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -621,10 +615,10 @@ def _onboard_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 ) @@ -632,19 +626,21 @@ def _onboard_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) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("OnboardResponse", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -720,10 +716,11 @@ def begin_onboard( 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("OnboardResponse", pipeline_response) + deserialized = self._deserialize("OnboardResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -749,7 +746,7 @@ def get_long_running_output(pipeline_response): def _trigger_evaluation_initial( self, body: Union[_models.TriggerEvaluationRequest, IO[bytes]], **kwargs: Any - ) -> Optional[_models.TriggerEvaluationResponse]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -763,7 +760,7 @@ def _trigger_evaluation_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.TriggerEvaluationResponse]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -781,10 +778,10 @@ def _trigger_evaluation_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 ) @@ -792,19 +789,21 @@ def _trigger_evaluation_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) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("TriggerEvaluationResponse", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -880,10 +879,11 @@ def begin_trigger_evaluation( 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("TriggerEvaluationResponse", pipeline_response) + deserialized = self._deserialize("TriggerEvaluationResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/operations/_report_operations.py b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/operations/_report_operations.py index b22e5fe881c4..2d92f6cefcb2 100644 --- a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/operations/_report_operations.py +++ b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/operations/_report_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 @@ -406,7 +406,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -422,7 +421,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 @@ -482,7 +480,6 @@ def get(self, report_name: str, **kwargs: Any) -> _models.ReportResource: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -497,7 +494,7 @@ def get(self, report_name: str, **kwargs: Any) -> _models.ReportResource: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ReportResource", pipeline_response) + deserialized = self._deserialize("ReportResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -506,7 +503,7 @@ def get(self, report_name: str, **kwargs: Any) -> _models.ReportResource: def _create_or_update_initial( self, report_name: str, properties: Union[_models.ReportResource, IO[bytes]], **kwargs: Any - ) -> _models.ReportResource: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -520,7 +517,7 @@ def _create_or_update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ReportResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -539,10 +536,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 ) @@ -550,18 +547,19 @@ 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) response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ReportResource", pipeline_response) - if response.status_code == 201: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = self._deserialize("ReportResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -653,10 +651,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("ReportResource", pipeline_response) + deserialized = self._deserialize("ReportResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -682,7 +681,7 @@ def get_long_running_output(pipeline_response): def _update_initial( self, report_name: str, properties: Union[_models.ReportResourcePatch, IO[bytes]], **kwargs: Any - ) -> Optional[_models.ReportResource]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -696,7 +695,7 @@ def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.ReportResource]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -715,10 +714,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 ) @@ -726,19 +725,21 @@ 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) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ReportResource", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -826,10 +827,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("ReportResource", pipeline_response) + deserialized = self._deserialize("ReportResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -853,9 +855,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, report_name: str, **kwargs: Any - ) -> None: + def _delete_initial(self, report_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -868,7 +868,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._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( report_name=report_name, @@ -876,10 +876,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 ) @@ -887,6 +887,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [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) @@ -896,8 +900,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + 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, report_name: str, **kwargs: Any) -> LROPoller[None]: @@ -918,7 +926,7 @@ def begin_delete(self, report_name: str, **kwargs: Any) -> LROPoller[None]: 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( report_name=report_name, api_version=api_version, cls=lambda x, y, z: x, @@ -926,6 +934,7 @@ def begin_delete(self, report_name: str, **kwargs: Any) -> LROPoller[None]: 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 @@ -1038,7 +1047,6 @@ def nested_resource_check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1053,14 +1061,14 @@ def nested_resource_check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _fix_initial(self, report_name: str, **kwargs: Any) -> Optional[_models.ReportFixResult]: + def _fix_initial(self, report_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1073,7 +1081,7 @@ def _fix_initial(self, report_name: str, **kwargs: Any) -> Optional[_models.Repo _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.ReportFixResult]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_fix_request( report_name=report_name, @@ -1081,10 +1089,10 @@ def _fix_initial(self, report_name: str, **kwargs: Any) -> Optional[_models.Repo 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 ) @@ -1092,19 +1100,21 @@ def _fix_initial(self, report_name: str, **kwargs: Any) -> Optional[_models.Repo 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) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ReportFixResult", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1140,10 +1150,11 @@ def begin_fix(self, report_name: str, **kwargs: Any) -> LROPoller[_models.Report 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("ReportFixResult", pipeline_response) + deserialized = self._deserialize("ReportFixResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1198,7 +1209,6 @@ def get_scoping_questions(self, report_name: str, **kwargs: Any) -> _models.Scop headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1213,7 +1223,7 @@ def get_scoping_questions(self, report_name: str, **kwargs: Any) -> _models.Scop error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ScopingQuestions", pipeline_response) + deserialized = self._deserialize("ScopingQuestions", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -1222,7 +1232,7 @@ def get_scoping_questions(self, report_name: str, **kwargs: Any) -> _models.Scop def _sync_cert_record_initial( self, report_name: str, body: Union[_models.SyncCertRecordRequest, IO[bytes]], **kwargs: Any - ) -> Optional[_models.SyncCertRecordResponse]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1236,7 +1246,7 @@ def _sync_cert_record_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.SyncCertRecordResponse]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1255,10 +1265,10 @@ def _sync_cert_record_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 ) @@ -1266,19 +1276,21 @@ def _sync_cert_record_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) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("SyncCertRecordResponse", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1366,10 +1378,11 @@ def begin_sync_cert_record( 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("SyncCertRecordResponse", pipeline_response) + deserialized = self._deserialize("SyncCertRecordResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -1393,7 +1406,7 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - def _verify_initial(self, report_name: str, **kwargs: Any) -> Optional[_models.ReportVerificationResult]: + def _verify_initial(self, report_name: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1406,7 +1419,7 @@ def _verify_initial(self, report_name: str, **kwargs: Any) -> Optional[_models.R _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Optional[_models.ReportVerificationResult]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_verify_request( report_name=report_name, @@ -1414,10 +1427,10 @@ def _verify_initial(self, report_name: str, **kwargs: Any) -> Optional[_models.R 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 ) @@ -1425,19 +1438,21 @@ def _verify_initial(self, report_name: str, **kwargs: Any) -> Optional[_models.R 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) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("ReportVerificationResult", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -1472,10 +1487,11 @@ def begin_verify(self, report_name: str, **kwargs: Any) -> LROPoller[_models.Rep 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("ReportVerificationResult", pipeline_response) + deserialized = self._deserialize("ReportVerificationResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/operations/_scoping_configuration_operations.py b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/operations/_scoping_configuration_operations.py index cf349bf0f2c5..f8ddb5efae94 100644 --- a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/operations/_scoping_configuration_operations.py +++ b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/operations/_scoping_configuration_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 @@ -296,7 +292,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -311,7 +306,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ScopingConfigurationResource", pipeline_response) + deserialized = self._deserialize("ScopingConfigurationResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -428,7 +423,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -443,11 +437,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("ScopingConfigurationResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("ScopingConfigurationResource", pipeline_response) + deserialized = self._deserialize("ScopingConfigurationResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -489,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/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/operations/_snapshot_operations.py b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/operations/_snapshot_operations.py index 970ef840f99f..bcf10fd6b295 100644 --- a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/operations/_snapshot_operations.py +++ b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/operations/_snapshot_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 @@ -239,7 +239,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -255,7 +254,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 @@ -318,7 +316,6 @@ def get(self, report_name: str, snapshot_name: str, **kwargs: Any) -> _models.Sn headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -333,7 +330,7 @@ def get(self, report_name: str, snapshot_name: str, **kwargs: Any) -> _models.Sn error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SnapshotResource", pipeline_response) + deserialized = self._deserialize("SnapshotResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -346,7 +343,7 @@ def _download_initial( snapshot_name: str, body: Union[_models.SnapshotDownloadRequest, IO[bytes]], **kwargs: Any - ) -> Optional[_models.DownloadResponse]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -360,7 +357,7 @@ def _download_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.DownloadResponse]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -380,10 +377,10 @@ def _download_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 ) @@ -391,19 +388,21 @@ def _download_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) - deserialized = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("DownloadResponse", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -509,10 +508,11 @@ def begin_download( 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("DownloadResponse", pipeline_response) + deserialized = self._deserialize("DownloadResponse", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/operations/_webhook_operations.py b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/operations/_webhook_operations.py index 2cc89b2528e3..5f6870863591 100644 --- a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/operations/_webhook_operations.py +++ b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/azure/mgmt/appcomplianceautomation/operations/_webhook_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 @@ -293,7 +291,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -309,7 +306,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 +368,6 @@ def get(self, report_name: str, webhook_name: str, **kwargs: Any) -> _models.Web headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -387,7 +382,7 @@ def get(self, report_name: str, webhook_name: str, **kwargs: Any) -> _models.Web error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebhookResource", pipeline_response) + deserialized = self._deserialize("WebhookResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -499,7 +494,6 @@ def create_or_update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -514,11 +508,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("WebhookResource", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("WebhookResource", pipeline_response) + deserialized = self._deserialize("WebhookResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -631,7 +621,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -646,7 +635,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("WebhookResource", pipeline_response) + deserialized = self._deserialize("WebhookResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -688,7 +677,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/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/conftest.py b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/conftest.py new file mode 100644 index 000000000000..114487a96db6 --- /dev/null +++ b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/conftest.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 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): + appcomplianceautomationmgmt_subscription_id = os.environ.get( + "AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000" + ) + appcomplianceautomationmgmt_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + appcomplianceautomationmgmt_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + appcomplianceautomationmgmt_client_secret = os.environ.get( + "AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer( + regex=appcomplianceautomationmgmt_subscription_id, value="00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer( + regex=appcomplianceautomationmgmt_tenant_id, value="00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer( + regex=appcomplianceautomationmgmt_client_id, value="00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer( + regex=appcomplianceautomationmgmt_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/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_evidence_operations.py b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_evidence_operations.py new file mode 100644 index 000000000000..07617ccd7342 --- /dev/null +++ b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_evidence_operations.py @@ -0,0 +1,100 @@ +# 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.appcomplianceautomation import AppComplianceAutomationMgmtClient + +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 TestAppComplianceAutomationMgmtEvidenceOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppComplianceAutomationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_report(self, resource_group): + response = self.client.evidence.list_by_report( + report_name="str", + api_version="2024-06-27", + ) + 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.evidence.get( + report_name="str", + evidence_name="str", + api_version="2024-06-27", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.evidence.create_or_update( + report_name="str", + evidence_name="str", + properties={ + "properties": { + "filePath": "str", + "controlId": "str", + "evidenceType": "str", + "extraData": "str", + "provisioningState": "str", + "responsibilityId": "str", + }, + "id": "str", + "name": "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-06-27", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.evidence.delete( + report_name="str", + evidence_name="str", + api_version="2024-06-27", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_download(self, resource_group): + response = self.client.evidence.download( + report_name="str", + evidence_name="str", + body={"offerGuid": "str", "reportCreatorTenantId": "str"}, + api_version="2024-06-27", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_evidence_operations_async.py b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_evidence_operations_async.py new file mode 100644 index 000000000000..8c58d84fe342 --- /dev/null +++ b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_evidence_operations_async.py @@ -0,0 +1,101 @@ +# 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.appcomplianceautomation.aio import AppComplianceAutomationMgmtClient + +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 TestAppComplianceAutomationMgmtEvidenceOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppComplianceAutomationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_report(self, resource_group): + response = self.client.evidence.list_by_report( + report_name="str", + api_version="2024-06-27", + ) + 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.evidence.get( + report_name="str", + evidence_name="str", + api_version="2024-06-27", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.evidence.create_or_update( + report_name="str", + evidence_name="str", + properties={ + "properties": { + "filePath": "str", + "controlId": "str", + "evidenceType": "str", + "extraData": "str", + "provisioningState": "str", + "responsibilityId": "str", + }, + "id": "str", + "name": "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-06-27", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.evidence.delete( + report_name="str", + evidence_name="str", + api_version="2024-06-27", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_download(self, resource_group): + response = await self.client.evidence.download( + report_name="str", + evidence_name="str", + body={"offerGuid": "str", "reportCreatorTenantId": "str"}, + api_version="2024-06-27", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_operations.py b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_operations.py new file mode 100644 index 000000000000..62d4359b59d9 --- /dev/null +++ b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_operations.py @@ -0,0 +1,29 @@ +# 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.appcomplianceautomation import AppComplianceAutomationMgmtClient + +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 TestAppComplianceAutomationMgmtOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppComplianceAutomationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.operations.list( + api_version="2024-06-27", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_operations_async.py b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_operations_async.py new file mode 100644 index 000000000000..0a3c83082238 --- /dev/null +++ b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_operations_async.py @@ -0,0 +1,30 @@ +# 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.appcomplianceautomation.aio import AppComplianceAutomationMgmtClient + +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 TestAppComplianceAutomationMgmtOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppComplianceAutomationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.operations.list( + api_version="2024-06-27", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_provider_actions_operations.py b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_provider_actions_operations.py new file mode 100644 index 000000000000..3c34ae001341 --- /dev/null +++ b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_provider_actions_operations.py @@ -0,0 +1,85 @@ +# 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.appcomplianceautomation import AppComplianceAutomationMgmtClient + +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 TestAppComplianceAutomationMgmtProviderActionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppComplianceAutomationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_check_name_availability(self, resource_group): + response = self.client.provider_actions.check_name_availability( + body={"name": "str", "type": "str"}, + api_version="2024-06-27", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_collection_count(self, resource_group): + response = self.client.provider_actions.get_collection_count( + body={"type": "str"}, + api_version="2024-06-27", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get_overview_status(self, resource_group): + response = self.client.provider_actions.get_overview_status( + body={"type": "str"}, + api_version="2024-06-27", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_in_use_storage_accounts(self, resource_group): + response = self.client.provider_actions.list_in_use_storage_accounts( + body={"subscriptionIds": ["str"]}, + api_version="2024-06-27", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_onboard(self, resource_group): + response = self.client.provider_actions.begin_onboard( + body={"subscriptionIds": ["str"]}, + api_version="2024-06-27", + ).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_trigger_evaluation(self, resource_group): + response = self.client.provider_actions.begin_trigger_evaluation( + body={"resourceIds": ["str"]}, + api_version="2024-06-27", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_provider_actions_operations_async.py b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_provider_actions_operations_async.py new file mode 100644 index 000000000000..4f924574e274 --- /dev/null +++ b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_provider_actions_operations_async.py @@ -0,0 +1,90 @@ +# 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.appcomplianceautomation.aio import AppComplianceAutomationMgmtClient + +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 TestAppComplianceAutomationMgmtProviderActionsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppComplianceAutomationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_check_name_availability(self, resource_group): + response = await self.client.provider_actions.check_name_availability( + body={"name": "str", "type": "str"}, + api_version="2024-06-27", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_collection_count(self, resource_group): + response = await self.client.provider_actions.get_collection_count( + body={"type": "str"}, + api_version="2024-06-27", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get_overview_status(self, resource_group): + response = await self.client.provider_actions.get_overview_status( + body={"type": "str"}, + api_version="2024-06-27", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_in_use_storage_accounts(self, resource_group): + response = await self.client.provider_actions.list_in_use_storage_accounts( + body={"subscriptionIds": ["str"]}, + api_version="2024-06-27", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_onboard(self, resource_group): + response = await ( + await self.client.provider_actions.begin_onboard( + body={"subscriptionIds": ["str"]}, + api_version="2024-06-27", + ) + ).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_trigger_evaluation(self, resource_group): + response = await ( + await self.client.provider_actions.begin_trigger_evaluation( + body={"resourceIds": ["str"]}, + api_version="2024-06-27", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_report_operations.py b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_report_operations.py new file mode 100644 index 000000000000..b85dbd150cc1 --- /dev/null +++ b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_report_operations.py @@ -0,0 +1,240 @@ +# 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.appcomplianceautomation import AppComplianceAutomationMgmtClient + +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 TestAppComplianceAutomationMgmtReportOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppComplianceAutomationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.report.list( + api_version="2024-06-27", + ) + 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.report.get( + report_name="str", + api_version="2024-06-27", + ) + + # 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.report.begin_create_or_update( + report_name="str", + properties={ + "properties": { + "resources": [ + { + "resourceId": "str", + "accountId": "str", + "resourceKind": "str", + "resourceOrigin": "str", + "resourceType": "str", + } + ], + "timeZone": "str", + "triggerTime": "2020-02-20 00:00:00", + "certRecords": [ + { + "certificationStatus": "str", + "controls": [{"controlId": "str", "controlStatus": "str"}], + "ingestionStatus": "str", + "offerGuid": "str", + } + ], + "complianceStatus": { + "m365": { + "failedCount": 0, + "manualCount": 0, + "notApplicableCount": 0, + "passedCount": 0, + "pendingCount": 0, + } + }, + "errors": ["str"], + "lastTriggerTime": "2020-02-20 00:00:00", + "nextTriggerTime": "2020-02-20 00:00:00", + "offerGuid": "str", + "provisioningState": "str", + "status": "str", + "storageInfo": { + "accountName": "str", + "location": "str", + "resourceGroup": "str", + "subscriptionId": "str", + }, + "subscriptions": ["str"], + "tenantId": "str", + }, + "id": "str", + "name": "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-06-27", + ).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.report.begin_update( + report_name="str", + properties={ + "properties": { + "certRecords": [ + { + "certificationStatus": "str", + "controls": [{"controlId": "str", "controlStatus": "str"}], + "ingestionStatus": "str", + "offerGuid": "str", + } + ], + "complianceStatus": { + "m365": { + "failedCount": 0, + "manualCount": 0, + "notApplicableCount": 0, + "passedCount": 0, + "pendingCount": 0, + } + }, + "errors": ["str"], + "lastTriggerTime": "2020-02-20 00:00:00", + "nextTriggerTime": "2020-02-20 00:00:00", + "offerGuid": "str", + "provisioningState": "str", + "resources": [ + { + "resourceId": "str", + "accountId": "str", + "resourceKind": "str", + "resourceOrigin": "str", + "resourceType": "str", + } + ], + "status": "str", + "storageInfo": { + "accountName": "str", + "location": "str", + "resourceGroup": "str", + "subscriptionId": "str", + }, + "subscriptions": ["str"], + "tenantId": "str", + "timeZone": "str", + "triggerTime": "2020-02-20 00:00:00", + } + }, + api_version="2024-06-27", + ).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.report.begin_delete( + report_name="str", + api_version="2024-06-27", + ).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_nested_resource_check_name_availability(self, resource_group): + response = self.client.report.nested_resource_check_name_availability( + report_name="str", + body={"name": "str", "type": "str"}, + api_version="2024-06-27", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_fix(self, resource_group): + response = self.client.report.begin_fix( + report_name="str", + api_version="2024-06-27", + ).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_get_scoping_questions(self, resource_group): + response = self.client.report.get_scoping_questions( + report_name="str", + api_version="2024-06-27", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_sync_cert_record(self, resource_group): + response = self.client.report.begin_sync_cert_record( + report_name="str", + body={ + "certRecord": { + "certificationStatus": "str", + "controls": [{"controlId": "str", "controlStatus": "str"}], + "ingestionStatus": "str", + "offerGuid": "str", + } + }, + api_version="2024-06-27", + ).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_verify(self, resource_group): + response = self.client.report.begin_verify( + report_name="str", + api_version="2024-06-27", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_report_operations_async.py b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_report_operations_async.py new file mode 100644 index 000000000000..59313fc4b2e4 --- /dev/null +++ b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_report_operations_async.py @@ -0,0 +1,253 @@ +# 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.appcomplianceautomation.aio import AppComplianceAutomationMgmtClient + +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 TestAppComplianceAutomationMgmtReportOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppComplianceAutomationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.report.list( + api_version="2024-06-27", + ) + 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.report.get( + report_name="str", + api_version="2024-06-27", + ) + + # 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.report.begin_create_or_update( + report_name="str", + properties={ + "properties": { + "resources": [ + { + "resourceId": "str", + "accountId": "str", + "resourceKind": "str", + "resourceOrigin": "str", + "resourceType": "str", + } + ], + "timeZone": "str", + "triggerTime": "2020-02-20 00:00:00", + "certRecords": [ + { + "certificationStatus": "str", + "controls": [{"controlId": "str", "controlStatus": "str"}], + "ingestionStatus": "str", + "offerGuid": "str", + } + ], + "complianceStatus": { + "m365": { + "failedCount": 0, + "manualCount": 0, + "notApplicableCount": 0, + "passedCount": 0, + "pendingCount": 0, + } + }, + "errors": ["str"], + "lastTriggerTime": "2020-02-20 00:00:00", + "nextTriggerTime": "2020-02-20 00:00:00", + "offerGuid": "str", + "provisioningState": "str", + "status": "str", + "storageInfo": { + "accountName": "str", + "location": "str", + "resourceGroup": "str", + "subscriptionId": "str", + }, + "subscriptions": ["str"], + "tenantId": "str", + }, + "id": "str", + "name": "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-06-27", + ) + ).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.report.begin_update( + report_name="str", + properties={ + "properties": { + "certRecords": [ + { + "certificationStatus": "str", + "controls": [{"controlId": "str", "controlStatus": "str"}], + "ingestionStatus": "str", + "offerGuid": "str", + } + ], + "complianceStatus": { + "m365": { + "failedCount": 0, + "manualCount": 0, + "notApplicableCount": 0, + "passedCount": 0, + "pendingCount": 0, + } + }, + "errors": ["str"], + "lastTriggerTime": "2020-02-20 00:00:00", + "nextTriggerTime": "2020-02-20 00:00:00", + "offerGuid": "str", + "provisioningState": "str", + "resources": [ + { + "resourceId": "str", + "accountId": "str", + "resourceKind": "str", + "resourceOrigin": "str", + "resourceType": "str", + } + ], + "status": "str", + "storageInfo": { + "accountName": "str", + "location": "str", + "resourceGroup": "str", + "subscriptionId": "str", + }, + "subscriptions": ["str"], + "tenantId": "str", + "timeZone": "str", + "triggerTime": "2020-02-20 00:00:00", + } + }, + api_version="2024-06-27", + ) + ).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.report.begin_delete( + report_name="str", + api_version="2024-06-27", + ) + ).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_nested_resource_check_name_availability(self, resource_group): + response = await self.client.report.nested_resource_check_name_availability( + report_name="str", + body={"name": "str", "type": "str"}, + api_version="2024-06-27", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_fix(self, resource_group): + response = await ( + await self.client.report.begin_fix( + report_name="str", + api_version="2024-06-27", + ) + ).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_get_scoping_questions(self, resource_group): + response = await self.client.report.get_scoping_questions( + report_name="str", + api_version="2024-06-27", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_sync_cert_record(self, resource_group): + response = await ( + await self.client.report.begin_sync_cert_record( + report_name="str", + body={ + "certRecord": { + "certificationStatus": "str", + "controls": [{"controlId": "str", "controlStatus": "str"}], + "ingestionStatus": "str", + "offerGuid": "str", + } + }, + api_version="2024-06-27", + ) + ).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_verify(self, resource_group): + response = await ( + await self.client.report.begin_verify( + report_name="str", + api_version="2024-06-27", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_scoping_configuration_operations.py b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_scoping_configuration_operations.py new file mode 100644 index 000000000000..a33520cffc98 --- /dev/null +++ b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_scoping_configuration_operations.py @@ -0,0 +1,80 @@ +# 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.appcomplianceautomation import AppComplianceAutomationMgmtClient + +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 TestAppComplianceAutomationMgmtScopingConfigurationOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppComplianceAutomationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.scoping_configuration.list( + report_name="str", + api_version="2024-06-27", + ) + 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.scoping_configuration.get( + report_name="str", + scoping_configuration_name="str", + api_version="2024-06-27", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.scoping_configuration.create_or_update( + report_name="str", + scoping_configuration_name="str", + properties={ + "properties": {"answers": [{"answers": ["str"], "questionId": "str"}], "provisioningState": "str"}, + "id": "str", + "name": "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-06-27", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.scoping_configuration.delete( + report_name="str", + scoping_configuration_name="str", + api_version="2024-06-27", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_scoping_configuration_operations_async.py b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_scoping_configuration_operations_async.py new file mode 100644 index 000000000000..ea52e3a14f71 --- /dev/null +++ b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_scoping_configuration_operations_async.py @@ -0,0 +1,81 @@ +# 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.appcomplianceautomation.aio import AppComplianceAutomationMgmtClient + +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 TestAppComplianceAutomationMgmtScopingConfigurationOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppComplianceAutomationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.scoping_configuration.list( + report_name="str", + api_version="2024-06-27", + ) + 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.scoping_configuration.get( + report_name="str", + scoping_configuration_name="str", + api_version="2024-06-27", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.scoping_configuration.create_or_update( + report_name="str", + scoping_configuration_name="str", + properties={ + "properties": {"answers": [{"answers": ["str"], "questionId": "str"}], "provisioningState": "str"}, + "id": "str", + "name": "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-06-27", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.scoping_configuration.delete( + report_name="str", + scoping_configuration_name="str", + api_version="2024-06-27", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_snapshot_operations.py b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_snapshot_operations.py new file mode 100644 index 000000000000..7b1221e31814 --- /dev/null +++ b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_snapshot_operations.py @@ -0,0 +1,55 @@ +# 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.appcomplianceautomation import AppComplianceAutomationMgmtClient + +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 TestAppComplianceAutomationMgmtSnapshotOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppComplianceAutomationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.snapshot.list( + report_name="str", + api_version="2024-06-27", + ) + 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.snapshot.get( + report_name="str", + snapshot_name="str", + api_version="2024-06-27", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_download(self, resource_group): + response = self.client.snapshot.begin_download( + report_name="str", + snapshot_name="str", + body={"downloadType": "str", "offerGuid": "str", "reportCreatorTenantId": "str"}, + api_version="2024-06-27", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_snapshot_operations_async.py b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_snapshot_operations_async.py new file mode 100644 index 000000000000..5f9a045a5b6e --- /dev/null +++ b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_snapshot_operations_async.py @@ -0,0 +1,58 @@ +# 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.appcomplianceautomation.aio import AppComplianceAutomationMgmtClient + +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 TestAppComplianceAutomationMgmtSnapshotOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppComplianceAutomationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.snapshot.list( + report_name="str", + api_version="2024-06-27", + ) + 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.snapshot.get( + report_name="str", + snapshot_name="str", + api_version="2024-06-27", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_download(self, resource_group): + response = await ( + await self.client.snapshot.begin_download( + report_name="str", + snapshot_name="str", + body={"downloadType": "str", "offerGuid": "str", "reportCreatorTenantId": "str"}, + api_version="2024-06-27", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_webhook_operations.py b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_webhook_operations.py new file mode 100644 index 000000000000..deb1ba643a7c --- /dev/null +++ b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_webhook_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.appcomplianceautomation import AppComplianceAutomationMgmtClient + +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 TestAppComplianceAutomationMgmtWebhookOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppComplianceAutomationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.webhook.list( + report_name="str", + api_version="2024-06-27", + ) + 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.webhook.get( + report_name="str", + webhook_name="str", + api_version="2024-06-27", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.webhook.create_or_update( + report_name="str", + webhook_name="str", + properties={ + "properties": { + "contentType": "str", + "deliveryStatus": "str", + "enableSslVerification": "str", + "events": ["str"], + "payloadUrl": "str", + "provisioningState": "str", + "sendAllEvents": "str", + "status": "str", + "tenantId": "str", + "updateWebhookKey": "str", + "webhookId": "str", + "webhookKey": "str", + "webhookKeyEnabled": "str", + }, + "id": "str", + "name": "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-06-27", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.webhook.update( + report_name="str", + webhook_name="str", + properties={ + "properties": { + "contentType": "str", + "deliveryStatus": "str", + "enableSslVerification": "str", + "events": ["str"], + "payloadUrl": "str", + "provisioningState": "str", + "sendAllEvents": "str", + "status": "str", + "tenantId": "str", + "updateWebhookKey": "str", + "webhookId": "str", + "webhookKey": "str", + "webhookKeyEnabled": "str", + } + }, + api_version="2024-06-27", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.webhook.delete( + report_name="str", + webhook_name="str", + api_version="2024-06-27", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_webhook_operations_async.py b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_webhook_operations_async.py new file mode 100644 index 000000000000..73f680249fc4 --- /dev/null +++ b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/generated_tests/test_app_compliance_automation_mgmt_webhook_operations_async.py @@ -0,0 +1,124 @@ +# 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.appcomplianceautomation.aio import AppComplianceAutomationMgmtClient + +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 TestAppComplianceAutomationMgmtWebhookOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(AppComplianceAutomationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.webhook.list( + report_name="str", + api_version="2024-06-27", + ) + 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.webhook.get( + report_name="str", + webhook_name="str", + api_version="2024-06-27", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.webhook.create_or_update( + report_name="str", + webhook_name="str", + properties={ + "properties": { + "contentType": "str", + "deliveryStatus": "str", + "enableSslVerification": "str", + "events": ["str"], + "payloadUrl": "str", + "provisioningState": "str", + "sendAllEvents": "str", + "status": "str", + "tenantId": "str", + "updateWebhookKey": "str", + "webhookId": "str", + "webhookKey": "str", + "webhookKeyEnabled": "str", + }, + "id": "str", + "name": "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-06-27", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.webhook.update( + report_name="str", + webhook_name="str", + properties={ + "properties": { + "contentType": "str", + "deliveryStatus": "str", + "enableSslVerification": "str", + "events": ["str"], + "payloadUrl": "str", + "provisioningState": "str", + "sendAllEvents": "str", + "status": "str", + "tenantId": "str", + "updateWebhookKey": "str", + "webhookId": "str", + "webhookKey": "str", + "webhookKeyEnabled": "str", + } + }, + api_version="2024-06-27", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.webhook.delete( + report_name="str", + webhook_name="str", + api_version="2024-06-27", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/setup.py b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/setup.py index 4cb815f9aa9a..9953ab017fb2 100644 --- a/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/setup.py +++ b/sdk/appcomplianceautomation/azure-mgmt-appcomplianceautomation/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", ], diff --git a/sdk/computefleet/azure-mgmt-computefleet/_meta.json b/sdk/computefleet/azure-mgmt-computefleet/_meta.json index 66649e3ac4f6..634bc5bfa252 100644 --- a/sdk/computefleet/azure-mgmt-computefleet/_meta.json +++ b/sdk/computefleet/azure-mgmt-computefleet/_meta.json @@ -1,6 +1,6 @@ { - "commit": "c1cea38fb7e5cec9afe223a2ed15cbe2fbeecbdb", - "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "commit": "bc35ae3b67f3c1ed5ca85817337647bfd89f92c8", + "repository_url": "https://github.com/test-repo-billy/azure-rest-api-specs", "typespec_src": "specification/azurefleet/AzureFleet.Management", - "@azure-tools/typespec-python": "0.26.0" + "@azure-tools/typespec-python": "0.27.1" } \ No newline at end of file diff --git a/sdk/computefleet/azure-mgmt-computefleet/azure/mgmt/computefleet/_model_base.py b/sdk/computefleet/azure-mgmt-computefleet/azure/mgmt/computefleet/_model_base.py index 43fd8c7e9b1b..7d82ac3456cb 100644 --- a/sdk/computefleet/azure-mgmt-computefleet/azure/mgmt/computefleet/_model_base.py +++ b/sdk/computefleet/azure-mgmt-computefleet/azure/mgmt/computefleet/_model_base.py @@ -563,6 +563,7 @@ def as_dict(self, *, exclude_readonly: bool = False) -> typing.Dict[str, typing. """ result = {} + readonly_props = [] if exclude_readonly: readonly_props = [p._rest_name for p in self._attr_to_rest_field.values() if _is_readonly(p)] for k, v in self.items(): diff --git a/sdk/computefleet/azure-mgmt-computefleet/azure/mgmt/computefleet/aio/operations/_operations.py b/sdk/computefleet/azure-mgmt-computefleet/azure/mgmt/computefleet/aio/operations/_operations.py index a2a09b821285..ea2530c1f78a 100644 --- a/sdk/computefleet/azure-mgmt-computefleet/azure/mgmt/computefleet/aio/operations/_operations.py +++ b/sdk/computefleet/azure-mgmt-computefleet/azure/mgmt/computefleet/aio/operations/_operations.py @@ -741,13 +741,10 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = response.iter_bytes() - if response.status_code == 201: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -3546,14 +3543,11 @@ async def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = response.iter_bytes() - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -6310,10 +6304,7 @@ async def _delete_initial(self, resource_group_name: str, fleet_name: str, **kwa response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = response.iter_bytes() - - if response.status_code == 204: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore diff --git a/sdk/computefleet/azure-mgmt-computefleet/azure/mgmt/computefleet/models/_models.py b/sdk/computefleet/azure-mgmt-computefleet/azure/mgmt/computefleet/models/_models.py index fb90cf1120f2..db54890be3f5 100644 --- a/sdk/computefleet/azure-mgmt-computefleet/azure/mgmt/computefleet/models/_models.py +++ b/sdk/computefleet/azure-mgmt-computefleet/azure/mgmt/computefleet/models/_models.py @@ -467,7 +467,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class ComputeProfile(_model_base.Model): """Compute Profile to use for running user's workloads. - All required parameters must be populated in order to send to server. :ivar base_virtual_machine_profile: Base Virtual Machine Profile Properties to be specified according to @@ -784,7 +783,6 @@ class TrackedResource(Resource): Readonly variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long @@ -832,7 +830,6 @@ class Fleet(TrackedResource): Readonly variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long @@ -896,7 +893,6 @@ class FleetProperties(_model_base.Model): Readonly variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting", and "Migrating". @@ -1131,7 +1127,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class KeyVaultSecretReference(_model_base.Model): """Describes a reference to Key Vault Secret. - All required parameters must be populated in order to send to server. :ivar secret_url: The URL referencing a secret in a Key Vault. Required. :vartype secret_url: str @@ -1343,7 +1338,6 @@ class ManagedServiceIdentity(_model_base.Model): Readonly variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. :ivar principal_id: The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity. @@ -1654,7 +1648,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class Plan(_model_base.Model): """Plan for the resource. - All required parameters must be populated in order to send to server. :ivar name: A user defined name of the 3rd Party Artifact that is being procured. Required. :vartype name: str @@ -2545,7 +2538,6 @@ class VirtualMachineScaleSet(_model_base.Model): Readonly variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to server. :ivar id: The compute RP resource id of the virtualMachineScaleSet "subscriptions/{subId}/resourceGroups/{rgName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}". @@ -2578,7 +2570,6 @@ class VirtualMachineScaleSet(_model_base.Model): class VirtualMachineScaleSetDataDisk(_model_base.Model): """Describes a virtual machine scale set data disk. - All required parameters must be populated in order to send to server. :ivar name: The disk name. :vartype name: str @@ -2929,7 +2920,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class VirtualMachineScaleSetIPConfiguration(_model_base.Model): """Describes a virtual machine scale set network profile's IP configuration. - All required parameters must be populated in order to send to server. :ivar name: The IP configuration name. Required. :vartype name: str @@ -3147,7 +3137,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class VirtualMachineScaleSetNetworkConfiguration(_model_base.Model): # pylint: disable=name-too-long """Describes a virtual machine scale set network profile's network configurations. - All required parameters must be populated in order to send to server. :ivar name: The network configuration name. Required. :vartype name: str @@ -3213,7 +3202,6 @@ class VirtualMachineScaleSetNetworkConfigurationProperties( ): # pylint: disable=too-many-instance-attributes,name-too-long """Describes a virtual machine scale set network profile's IP configuration. - All required parameters must be populated in order to send to server. :ivar primary: Specifies the primary network interface in case the virtual machine has more than 1 network interface. @@ -3357,7 +3345,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class VirtualMachineScaleSetOSDisk(_model_base.Model): # pylint: disable=too-many-instance-attributes """Describes a virtual machine scale set operating system disk. - All required parameters must be populated in order to send to server. :ivar name: The disk name. :vartype name: str @@ -3641,7 +3628,6 @@ class VirtualMachineScaleSetPublicIPAddressConfiguration(_model_base.Model): # """Describes a virtual machines scale set IP Configuration's PublicIPAddress configuration. - All required parameters must be populated in order to send to server. :ivar name: The publicIP address configuration name. Required. :vartype name: str @@ -3686,7 +3672,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: # pylint: disable=useles class VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings(_model_base.Model): # pylint: disable=name-too-long """Describes a virtual machines scale sets network configuration's DNS settings. - All required parameters must be populated in order to send to server. :ivar domain_name_label: The Domain name label.The concatenation of the domain name label and vm index @@ -3920,7 +3905,6 @@ class VMGalleryApplication(_model_base.Model): """Specifies the required information to reference a compute gallery application version. - All required parameters must be populated in order to send to server. :ivar tags: Optional, Specifies a passthrough value for more generic context. :vartype tags: str @@ -3989,7 +3973,6 @@ class VmSizeProfile(_model_base.Model): """Specifications about a VM Size. This will also contain the corresponding rank and weight in future. - All required parameters must be populated in order to send to server. :ivar name: The Sku name (e.g. 'Standard_DS1_v2'). Required. :vartype name: str diff --git a/sdk/computefleet/azure-mgmt-computefleet/azure/mgmt/computefleet/operations/_operations.py b/sdk/computefleet/azure-mgmt-computefleet/azure/mgmt/computefleet/operations/_operations.py index 7e0abfb829d1..0b578a6c542b 100644 --- a/sdk/computefleet/azure-mgmt-computefleet/azure/mgmt/computefleet/operations/_operations.py +++ b/sdk/computefleet/azure-mgmt-computefleet/azure/mgmt/computefleet/operations/_operations.py @@ -938,13 +938,10 @@ def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = response.iter_bytes() - if response.status_code == 201: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -3743,14 +3740,11 @@ def _update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} - if response.status_code == 200: - deserialized = response.iter_bytes() - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -6507,10 +6501,7 @@ def _delete_initial(self, resource_group_name: str, fleet_name: str, **kwargs: A response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = response.iter_bytes() - - if response.status_code == 204: - deserialized = response.iter_bytes() + deserialized = response.iter_bytes() if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore diff --git a/sdk/computefleet/azure-mgmt-computefleet/tsp-location.yaml b/sdk/computefleet/azure-mgmt-computefleet/tsp-location.yaml index 3edda0322bc0..9f29536f8f3d 100644 --- a/sdk/computefleet/azure-mgmt-computefleet/tsp-location.yaml +++ b/sdk/computefleet/azure-mgmt-computefleet/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/azurefleet/AzureFleet.Management -commit: c1cea38fb7e5cec9afe223a2ed15cbe2fbeecbdb -repo: Azure/azure-rest-api-specs -additionalDirectories: +commit: bc35ae3b67f3c1ed5ca85817337647bfd89f92c8 +repo: test-repo-billy/azure-rest-api-specs +additionalDirectories: \ No newline at end of file