diff --git a/sdk/scvmm/azure-mgmt-scvmm/_meta.json b/sdk/scvmm/azure-mgmt-scvmm/_meta.json index 15a49f7772e3..afa9c9c82d81 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/_meta.json +++ b/sdk/scvmm/azure-mgmt-scvmm/_meta.json @@ -1,11 +1,11 @@ { - "commit": "061505b89d5d0bbcc9f980e2276f79ff354ce286", - "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "commit": "6e8e67ec5f5768e43d9ef4490aad796d1a53bfcd", + "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.19.0", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/scvmm/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/scvmm/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/scvmm/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_configuration.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_configuration.py index 879e0c59f217..bcb0314131fb 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_configuration.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_configuration.py @@ -28,13 +28,13 @@ class ScVmmMgmtClientConfiguration: # pylint: disable=too-many-instance-attribu :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-10-07". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-06-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2023-10-07") + api_version: str = kwargs.pop("api_version", "2024-06-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_sc_vmm_mgmt_client.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_sc_vmm_mgmt_client.py index 636e29d71d08..21560ab7e296 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_sc_vmm_mgmt_client.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_sc_vmm_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 @@ -68,7 +69,7 @@ class ScVmmMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2023-10-07". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-06-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -153,7 +154,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "ScVmmMgmtClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_serialization.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_serialization.py index f0c6180722c8..8139854b97bb 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_serialization.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_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/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_vendor.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_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/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_version.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_version.py index c47f66669f1b..e5754a47ce68 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_version.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_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/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/_configuration.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/_configuration.py index cee140bb6705..89c0b950e070 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/_configuration.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/_configuration.py @@ -28,13 +28,13 @@ class ScVmmMgmtClientConfiguration: # pylint: disable=too-many-instance-attribu :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-10-07". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-06-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2023-10-07") + api_version: str = kwargs.pop("api_version", "2024-06-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/_sc_vmm_mgmt_client.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/_sc_vmm_mgmt_client.py index d0ca81a9c92a..354daffbf611 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/_sc_vmm_mgmt_client.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/_sc_vmm_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 @@ -68,7 +69,7 @@ class ScVmmMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2023-10-07". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-06-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -155,7 +156,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "ScVmmMgmtClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_availability_sets_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_availability_sets_operations.py index 37cdc6d99805..e6af58b0602d 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_availability_sets_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_availability_sets_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._availability_sets_operations import ( build_create_or_update_request, build_delete_request, @@ -101,7 +101,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -117,7 +116,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -186,7 +184,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -202,7 +199,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -271,7 +267,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -286,7 +281,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("AvailabilitySet", pipeline_response) + deserialized = self._deserialize("AvailabilitySet", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -299,7 +294,7 @@ async def _create_or_update_initial( availability_set_resource_name: str, resource: Union[_models.AvailabilitySet, IO[bytes]], **kwargs: Any - ) -> _models.AvailabilitySet: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -313,7 +308,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.AvailabilitySet] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -334,10 +329,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 ) @@ -345,21 +340,22 @@ 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("AvailabilitySet", pipeline_response) - if response.status_code == 201: response_headers["Azure-AsyncOperation"] = self._deserialize( "str", response.headers.get("Azure-AsyncOperation") ) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = self._deserialize("AvailabilitySet", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -472,10 +468,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AvailabilitySet", pipeline_response) + deserialized = self._deserialize("AvailabilitySet", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -506,7 +503,7 @@ async def _update_initial( availability_set_resource_name: str, properties: Union[_models.AvailabilitySetTagsUpdate, IO[bytes]], **kwargs: Any - ) -> Optional[_models.AvailabilitySet]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -520,7 +517,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.AvailabilitySet]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -541,10 +538,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 ) @@ -552,19 +549,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("AvailabilitySet", 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 @@ -676,10 +675,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("AvailabilitySet", pipeline_response) + deserialized = self._deserialize("AvailabilitySet", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -704,13 +704,13 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, availability_set_resource_name: str, force: Optional[Union[str, _models.ForceDelete]] = None, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -723,7 +723,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( resource_group_name=resource_group_name, @@ -734,10 +734,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 ) @@ -745,6 +745,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) @@ -757,8 +761,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( @@ -793,7 +801,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, availability_set_resource_name=availability_set_resource_name, force=force, @@ -803,6 +811,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_clouds_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_clouds_operations.py index 9aedd2c897d7..385262776695 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_clouds_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_clouds_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._clouds_operations import ( build_create_or_update_request, build_delete_request, @@ -101,7 +101,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -117,7 +116,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -184,7 +182,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -200,7 +197,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -267,7 +263,6 @@ async def get(self, resource_group_name: str, cloud_resource_name: str, **kwargs headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -282,7 +277,7 @@ async def get(self, resource_group_name: str, cloud_resource_name: str, **kwargs error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Cloud", pipeline_response) + deserialized = self._deserialize("Cloud", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -295,7 +290,7 @@ async def _create_or_update_initial( cloud_resource_name: str, resource: Union[_models.Cloud, IO[bytes]], **kwargs: Any - ) -> _models.Cloud: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -309,7 +304,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.Cloud] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -330,10 +325,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 ) @@ -341,18 +336,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("Cloud", pipeline_response) - if response.status_code == 201: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = self._deserialize("Cloud", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -462,10 +458,11 @@ async def begin_create_or_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Cloud", pipeline_response) + deserialized = self._deserialize("Cloud", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -496,7 +493,7 @@ async def _update_initial( cloud_resource_name: str, properties: Union[_models.CloudTagsUpdate, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Cloud]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -510,7 +507,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.Cloud]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -531,10 +528,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 ) @@ -542,19 +539,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("Cloud", 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 @@ -663,10 +662,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("Cloud", pipeline_response) + deserialized = self._deserialize("Cloud", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -691,13 +691,13 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, cloud_resource_name: str, force: Optional[Union[str, _models.ForceDelete]] = None, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -710,7 +710,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( resource_group_name=resource_group_name, @@ -721,10 +721,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 ) @@ -732,6 +732,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) @@ -741,8 +745,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( @@ -777,7 +785,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, cloud_resource_name=cloud_resource_name, force=force, @@ -787,6 +795,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_guest_agents_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_guest_agents_operations.py index 771593ceca8f..b19cbc656fe6 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_guest_agents_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_guest_agents_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._guest_agents_operations import ( build_create_request, build_delete_request, @@ -102,7 +102,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -118,7 +117,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -181,7 +179,6 @@ async def get(self, resource_uri: str, **kwargs: Any) -> _models.GuestAgent: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -196,7 +193,7 @@ async def get(self, resource_uri: str, **kwargs: Any) -> _models.GuestAgent: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GuestAgent", pipeline_response) + deserialized = self._deserialize("GuestAgent", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -205,7 +202,7 @@ async def get(self, resource_uri: str, **kwargs: Any) -> _models.GuestAgent: async def _create_initial( self, resource_uri: str, resource: Union[_models.GuestAgent, IO[bytes]], **kwargs: Any - ) -> _models.GuestAgent: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -219,7 +216,7 @@ async def _create_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.GuestAgent] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -238,10 +235,10 @@ async def _create_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 ) @@ -249,18 +246,19 @@ async def _create_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("GuestAgent", pipeline_response) - if response.status_code == 201: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = self._deserialize("GuestAgent", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -350,10 +348,11 @@ async def begin_create( 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("GuestAgent", pipeline_response) + deserialized = self._deserialize("GuestAgent", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -411,7 +410,6 @@ async def delete(self, resource_uri: str, **kwargs: Any) -> None: # pylint: dis headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_inventory_items_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_inventory_items_operations.py index 7595d085b9d6..b4edb5bfcc41 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_inventory_items_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_inventory_items_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._inventory_items_operations import ( build_create_request, build_delete_request, @@ -106,7 +104,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -122,7 +119,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -194,7 +190,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -209,7 +204,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("InventoryItem", pipeline_response) + deserialized = self._deserialize("InventoryItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -342,7 +337,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -357,11 +351,7 @@ async def create( 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("InventoryItem", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("InventoryItem", pipeline_response) + deserialized = self._deserialize("InventoryItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -410,7 +400,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/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_operations.py index d7d2a1f60b09..6efa7351533f 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/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): @@ -87,7 +85,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -103,7 +100,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/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_machine_instances_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_machine_instances_operations.py index 6d8a3469a274..3518dacad004 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_machine_instances_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_machine_instances_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._virtual_machine_instances_operations import ( build_create_checkpoint_request, build_create_or_update_request, @@ -111,7 +111,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -127,7 +126,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -190,7 +188,6 @@ async def get(self, resource_uri: str, **kwargs: Any) -> _models.VirtualMachineI headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -205,7 +202,7 @@ async def get(self, resource_uri: str, **kwargs: Any) -> _models.VirtualMachineI error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -214,7 +211,7 @@ async def get(self, resource_uri: str, **kwargs: Any) -> _models.VirtualMachineI async def _create_or_update_initial( self, resource_uri: str, resource: Union[_models.VirtualMachineInstance, IO[bytes]], **kwargs: Any - ) -> _models.VirtualMachineInstance: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -228,7 +225,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.VirtualMachineInstance] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -247,10 +244,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 ) @@ -258,18 +255,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("VirtualMachineInstance", pipeline_response) - if response.status_code == 201: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -367,10 +365,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("VirtualMachineInstance", pipeline_response) + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -397,7 +396,7 @@ def get_long_running_output(pipeline_response): async def _update_initial( self, resource_uri: str, properties: Union[_models.VirtualMachineInstanceUpdate, IO[bytes]], **kwargs: Any - ) -> Optional[_models.VirtualMachineInstance]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -411,7 +410,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.VirtualMachineInstance]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -430,10 +429,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 ) @@ -441,19 +440,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("VirtualMachineInstance", 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 @@ -547,10 +548,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("VirtualMachineInstance", pipeline_response) + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -575,13 +577,13 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_uri: str, force: Optional[Union[str, _models.ForceDelete]] = None, delete_from_host: Optional[Union[str, _models.DeleteFromHost]] = None, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -594,7 +596,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( resource_uri=resource_uri, @@ -604,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 ) @@ -615,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) @@ -624,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( @@ -661,7 +671,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_uri=resource_uri, force=force, delete_from_host=delete_from_host, @@ -671,6 +681,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -695,9 +706,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _create_checkpoint_initial( # pylint: disable=inconsistent-return-statements + async def _create_checkpoint_initial( self, resource_uri: str, body: Union[_models.VirtualMachineCreateCheckpoint, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -711,7 +722,7 @@ async def _create_checkpoint_initial( # pylint: disable=inconsistent-return-sta 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[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -730,10 +741,10 @@ async def _create_checkpoint_initial( # pylint: disable=inconsistent-return-sta 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 ) @@ -741,6 +752,10 @@ async def _create_checkpoint_initial( # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -749,8 +764,12 @@ async def _create_checkpoint_initial( # pylint: disable=inconsistent-return-sta 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 @overload async def begin_create_checkpoint( @@ -827,7 +846,7 @@ async def begin_create_checkpoint( 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._create_checkpoint_initial( # type: ignore + raw_result = await self._create_checkpoint_initial( resource_uri=resource_uri, body=body, api_version=api_version, @@ -837,6 +856,7 @@ async def begin_create_checkpoint( 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 @@ -860,9 +880,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _delete_checkpoint_initial( # pylint: disable=inconsistent-return-statements + async def _delete_checkpoint_initial( self, resource_uri: str, body: Union[_models.VirtualMachineDeleteCheckpoint, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -876,7 +896,7 @@ async def _delete_checkpoint_initial( # pylint: disable=inconsistent-return-sta 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[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -895,10 +915,10 @@ async def _delete_checkpoint_initial( # pylint: disable=inconsistent-return-sta 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 ) @@ -906,6 +926,10 @@ async def _delete_checkpoint_initial( # pylint: disable=inconsistent-return-sta response = pipeline_response.http_response if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -914,8 +938,12 @@ async def _delete_checkpoint_initial( # pylint: disable=inconsistent-return-sta 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 @overload async def begin_delete_checkpoint( @@ -992,7 +1020,7 @@ async def begin_delete_checkpoint( 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_checkpoint_initial( # type: ignore + raw_result = await self._delete_checkpoint_initial( resource_uri=resource_uri, body=body, api_version=api_version, @@ -1002,6 +1030,7 @@ async def begin_delete_checkpoint( 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 @@ -1025,9 +1054,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restart_initial( # pylint: disable=inconsistent-return-statements - self, resource_uri: str, **kwargs: Any - ) -> None: + async def _restart_initial(self, resource_uri: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1040,7 +1067,7 @@ async def _restart_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_restart_request( resource_uri=resource_uri, @@ -1048,10 +1075,10 @@ async def _restart_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 ) @@ -1059,6 +1086,10 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1067,8 +1098,12 @@ async def _restart_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_restart(self, resource_uri: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -1092,7 +1127,7 @@ async def begin_restart(self, resource_uri: str, **kwargs: Any) -> AsyncLROPolle 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._restart_initial( # type: ignore + raw_result = await self._restart_initial( resource_uri=resource_uri, api_version=api_version, cls=lambda x, y, z: x, @@ -1100,6 +1135,7 @@ async def begin_restart(self, resource_uri: str, **kwargs: Any) -> AsyncLROPolle 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 @@ -1123,9 +1159,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _restore_checkpoint_initial( # pylint: disable=inconsistent-return-statements + async def _restore_checkpoint_initial( self, resource_uri: str, body: Union[_models.VirtualMachineRestoreCheckpoint, IO[bytes]], **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1139,7 +1175,7 @@ async def _restore_checkpoint_initial( # pylint: disable=inconsistent-return-st 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[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1158,10 +1194,10 @@ async def _restore_checkpoint_initial( # pylint: disable=inconsistent-return-st 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 ) @@ -1169,6 +1205,10 @@ async def _restore_checkpoint_initial( # pylint: disable=inconsistent-return-st response = pipeline_response.http_response if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1177,8 +1217,12 @@ async def _restore_checkpoint_initial( # pylint: disable=inconsistent-return-st 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 @overload async def begin_restore_checkpoint( @@ -1255,7 +1299,7 @@ async def begin_restore_checkpoint( 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._restore_checkpoint_initial( # type: ignore + raw_result = await self._restore_checkpoint_initial( resource_uri=resource_uri, body=body, api_version=api_version, @@ -1265,6 +1309,7 @@ async def begin_restore_checkpoint( 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 @@ -1288,9 +1333,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _start_initial( # pylint: disable=inconsistent-return-statements - self, resource_uri: str, **kwargs: Any - ) -> None: + async def _start_initial(self, resource_uri: str, **kwargs: Any) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1303,7 +1346,7 @@ async def _start_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_start_request( resource_uri=resource_uri, @@ -1311,10 +1354,10 @@ async def _start_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 ) @@ -1322,6 +1365,10 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1330,8 +1377,12 @@ async def _start_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_start(self, resource_uri: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -1355,7 +1406,7 @@ async def begin_start(self, resource_uri: 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._start_initial( # type: ignore + raw_result = await self._start_initial( resource_uri=resource_uri, api_version=api_version, cls=lambda x, y, z: x, @@ -1363,6 +1414,7 @@ async def begin_start(self, resource_uri: 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 @@ -1386,9 +1438,12 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _stop_initial( # pylint: disable=inconsistent-return-statements - self, resource_uri: str, body: Union[_models.StopVirtualMachineOptions, IO[bytes]], **kwargs: Any - ) -> None: + async def _stop_initial( + self, + resource_uri: str, + body: Optional[Union[_models.StopVirtualMachineOptions, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1402,7 +1457,7 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements 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[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1410,7 +1465,10 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements if isinstance(body, (IOBase, bytes)): _content = body else: - _json = self._serialize.body(body, "StopVirtualMachineOptions") + if body is not None: + _json = self._serialize.body(body, "StopVirtualMachineOptions") + else: + _json = None _request = build_stop_request( resource_uri=resource_uri, @@ -1421,10 +1479,10 @@ async def _stop_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 ) @@ -1432,6 +1490,10 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1440,14 +1502,18 @@ async def _stop_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 @overload async def begin_stop( self, resource_uri: str, - body: _models.StopVirtualMachineOptions, + body: Optional[_models.StopVirtualMachineOptions] = None, *, content_type: str = "application/json", **kwargs: Any @@ -1459,7 +1525,7 @@ async def begin_stop( :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. Required. :type resource_uri: str - :param body: The content of the action request. Required. + :param body: The content of the action request. Default value is None. :type body: ~azure.mgmt.scvmm.models.StopVirtualMachineOptions :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -1471,7 +1537,12 @@ async def begin_stop( @overload async def begin_stop( - self, resource_uri: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + self, + resource_uri: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any ) -> AsyncLROPoller[None]: """Implements the operation to stop a virtual machine. @@ -1480,7 +1551,7 @@ async def begin_stop( :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. Required. :type resource_uri: str - :param body: The content of the action request. Required. + :param body: The content of the action request. Default value is None. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -1492,7 +1563,10 @@ async def begin_stop( @distributed_trace_async async def begin_stop( - self, resource_uri: str, body: Union[_models.StopVirtualMachineOptions, IO[bytes]], **kwargs: Any + self, + resource_uri: str, + body: Optional[Union[_models.StopVirtualMachineOptions, IO[bytes]]] = None, + **kwargs: Any ) -> AsyncLROPoller[None]: """Implements the operation to stop a virtual machine. @@ -1502,7 +1576,7 @@ async def begin_stop( Required. :type resource_uri: str :param body: The content of the action request. Is either a StopVirtualMachineOptions type or a - IO[bytes] type. Required. + IO[bytes] type. Default value is None. :type body: ~azure.mgmt.scvmm.models.StopVirtualMachineOptions or IO[bytes] :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] @@ -1518,7 +1592,7 @@ async def begin_stop( 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._stop_initial( # type: ignore + raw_result = await self._stop_initial( resource_uri=resource_uri, body=body, api_version=api_version, @@ -1528,6 +1602,7 @@ async def begin_stop( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_machine_templates_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_machine_templates_operations.py index 80dd5d93bcfe..60b227aaa933 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_machine_templates_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_machine_templates_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._virtual_machine_templates_operations import ( build_create_or_update_request, build_delete_request, @@ -103,7 +103,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -119,7 +118,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -190,7 +188,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -206,7 +203,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -275,7 +271,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -290,7 +285,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("VirtualMachineTemplate", pipeline_response) + deserialized = self._deserialize("VirtualMachineTemplate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -303,7 +298,7 @@ async def _create_or_update_initial( virtual_machine_template_name: str, resource: Union[_models.VirtualMachineTemplate, IO[bytes]], **kwargs: Any - ) -> _models.VirtualMachineTemplate: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -317,7 +312,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.VirtualMachineTemplate] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -338,10 +333,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 ) @@ -349,18 +344,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("VirtualMachineTemplate", pipeline_response) - if response.status_code == 201: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = self._deserialize("VirtualMachineTemplate", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -473,10 +469,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("VirtualMachineTemplate", pipeline_response) + deserialized = self._deserialize("VirtualMachineTemplate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -507,7 +504,7 @@ async def _update_initial( virtual_machine_template_name: str, properties: Union[_models.VirtualMachineTemplateTagsUpdate, IO[bytes]], **kwargs: Any - ) -> Optional[_models.VirtualMachineTemplate]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -521,7 +518,7 @@ async def _update_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Optional[_models.VirtualMachineTemplate]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -542,10 +539,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 ) @@ -553,19 +550,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("VirtualMachineTemplate", 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 @@ -677,10 +676,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("VirtualMachineTemplate", pipeline_response) + deserialized = self._deserialize("VirtualMachineTemplate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -705,13 +705,13 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, virtual_machine_template_name: str, force: Optional[Union[str, _models.ForceDelete]] = None, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -724,7 +724,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( resource_group_name=resource_group_name, @@ -735,10 +735,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 ) @@ -746,6 +746,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) @@ -755,8 +759,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( @@ -791,7 +799,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, virtual_machine_template_name=virtual_machine_template_name, force=force, @@ -801,6 +809,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_networks_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_networks_operations.py index 1019d23348db..fc18c9c606f4 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_networks_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_virtual_networks_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._virtual_networks_operations import ( build_create_or_update_request, build_delete_request, @@ -101,7 +101,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -117,7 +116,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -186,7 +184,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -202,7 +199,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -269,7 +265,6 @@ async def get(self, resource_group_name: str, virtual_network_name: str, **kwarg headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -284,7 +279,7 @@ async def get(self, resource_group_name: str, virtual_network_name: str, **kwarg error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualNetwork", pipeline_response) + deserialized = self._deserialize("VirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -297,7 +292,7 @@ async def _create_or_update_initial( virtual_network_name: str, resource: Union[_models.VirtualNetwork, IO[bytes]], **kwargs: Any - ) -> _models.VirtualNetwork: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -311,7 +306,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.VirtualNetwork] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -332,10 +327,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 ) @@ -343,18 +338,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("VirtualNetwork", pipeline_response) - if response.status_code == 201: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = self._deserialize("VirtualNetwork", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -467,10 +463,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("VirtualNetwork", pipeline_response) + deserialized = self._deserialize("VirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -501,7 +498,7 @@ async def _update_initial( virtual_network_name: str, properties: Union[_models.VirtualNetworkTagsUpdate, IO[bytes]], **kwargs: Any - ) -> Optional[_models.VirtualNetwork]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -515,7 +512,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.VirtualNetwork]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -536,10 +533,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 ) @@ -547,19 +544,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("VirtualNetwork", 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 @@ -671,10 +670,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("VirtualNetwork", pipeline_response) + deserialized = self._deserialize("VirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -699,13 +699,13 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, virtual_network_name: str, force: Optional[Union[str, _models.ForceDelete]] = None, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -718,7 +718,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( resource_group_name=resource_group_name, @@ -729,10 +729,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 ) @@ -740,6 +740,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) @@ -749,8 +753,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( @@ -785,7 +793,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, virtual_network_name=virtual_network_name, force=force, @@ -795,6 +803,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_vm_instance_hybrid_identity_metadatas_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_vm_instance_hybrid_identity_metadatas_operations.py index 1fc490da6da3..ce280ebf7ca7 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_vm_instance_hybrid_identity_metadatas_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_vm_instance_hybrid_identity_metadatas_operations.py @@ -20,15 +20,13 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -from ..._vendor import _convert_request from ...operations._vm_instance_hybrid_identity_metadatas_operations import ( build_get_request, build_list_by_virtual_machine_instance_request, @@ -101,7 +99,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -117,7 +114,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -180,7 +176,6 @@ async def get(self, resource_uri: str, **kwargs: Any) -> _models.VmInstanceHybri headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -195,7 +190,7 @@ async def get(self, resource_uri: str, **kwargs: Any) -> _models.VmInstanceHybri error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VmInstanceHybridIdentityMetadata", pipeline_response) + deserialized = self._deserialize("VmInstanceHybridIdentityMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_vmm_servers_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_vmm_servers_operations.py index 8a9b797231dc..d39e948a9797 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_vmm_servers_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_vmm_servers_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._vmm_servers_operations import ( build_create_or_update_request, build_delete_request, @@ -101,7 +101,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -117,7 +116,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -184,7 +182,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -200,7 +197,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -267,7 +263,6 @@ async def get(self, resource_group_name: str, vmm_server_name: str, **kwargs: An headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -282,7 +277,7 @@ async def get(self, resource_group_name: str, vmm_server_name: str, **kwargs: An error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VmmServer", pipeline_response) + deserialized = self._deserialize("VmmServer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -295,7 +290,7 @@ async def _create_or_update_initial( vmm_server_name: str, resource: Union[_models.VmmServer, IO[bytes]], **kwargs: Any - ) -> _models.VmmServer: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -309,7 +304,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.VmmServer] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -330,10 +325,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 ) @@ -341,18 +336,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("VmmServer", pipeline_response) - if response.status_code == 201: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = self._deserialize("VmmServer", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -465,10 +461,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("VmmServer", pipeline_response) + deserialized = self._deserialize("VmmServer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -499,7 +496,7 @@ async def _update_initial( vmm_server_name: str, properties: Union[_models.VmmServerTagsUpdate, IO[bytes]], **kwargs: Any - ) -> Optional[_models.VmmServer]: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -513,7 +510,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.VmmServer]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -534,10 +531,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 ) @@ -545,19 +542,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("VmmServer", 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 @@ -669,10 +668,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("VmmServer", pipeline_response) + deserialized = self._deserialize("VmmServer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -697,13 +697,13 @@ def get_long_running_output(pipeline_response): self._client, raw_result, get_long_running_output, polling_method # type: ignore ) - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, vmm_server_name: str, force: Optional[Union[str, _models.ForceDelete]] = None, **kwargs: Any - ) -> None: + ) -> AsyncIterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -716,7 +716,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( resource_group_name=resource_group_name, @@ -727,10 +727,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 ) @@ -738,6 +738,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) @@ -747,8 +751,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( @@ -783,7 +791,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, vmm_server_name=vmm_server_name, force=force, @@ -793,6 +801,7 @@ async def begin_delete( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/models/_models_py3.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/models/_models_py3.py index fa5e40b313af..4c0d8894af91 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/models/_models_py3.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/models/_models_py3.py @@ -921,6 +921,9 @@ class GuestAgentProperties(_serialization.Model): :ivar provisioning_state: Provisioning state of the resource. Known values are: "Succeeded", "Failed", "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". :vartype provisioning_state: str or ~azure.mgmt.scvmm.models.ProvisioningState + :ivar private_link_scope_resource_id: The resource id of the private link scope this machine is + assigned to, if any. + :vartype private_link_scope_resource_id: str """ _validation = { @@ -938,6 +941,7 @@ class GuestAgentProperties(_serialization.Model): "status": {"key": "status", "type": "str"}, "custom_resource_name": {"key": "customResourceName", "type": "str"}, "provisioning_state": {"key": "provisioningState", "type": "str"}, + "private_link_scope_resource_id": {"key": "privateLinkScopeResourceId", "type": "str"}, } def __init__( @@ -946,6 +950,7 @@ def __init__( credentials: Optional["_models.GuestCredential"] = None, http_proxy_config: Optional["_models.HttpProxyConfiguration"] = None, provisioning_action: Optional[Union[str, "_models.ProvisioningAction"]] = None, + private_link_scope_resource_id: Optional[str] = None, **kwargs: Any ) -> None: """ @@ -956,6 +961,9 @@ def __init__( :keyword provisioning_action: Gets or sets the guest agent provisioning action. Known values are: "install", "uninstall", and "repair". :paramtype provisioning_action: str or ~azure.mgmt.scvmm.models.ProvisioningAction + :keyword private_link_scope_resource_id: The resource id of the private link scope this machine + is assigned to, if any. + :paramtype private_link_scope_resource_id: str """ super().__init__(**kwargs) self.uuid = None @@ -965,6 +973,7 @@ def __init__( self.status = None self.custom_resource_name = None self.provisioning_state = None + self.private_link_scope_resource_id = private_link_scope_resource_id class GuestCredential(_serialization.Model): @@ -1742,7 +1751,7 @@ def __init__(self, **kwargs: Any) -> None: self.next_link = None -class OsProfileForVmInstance(_serialization.Model): +class OsProfileForVmInstance(_serialization.Model): # pylint: disable=too-many-instance-attributes """Defines the resource properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -1757,6 +1766,21 @@ class OsProfileForVmInstance(_serialization.Model): :vartype os_sku: str :ivar os_version: Gets os version. :vartype os_version: str + :ivar domain_name: Gets or sets the domain name. + :vartype domain_name: str + :ivar domain_username: Gets or sets the domain username. + :vartype domain_username: str + :ivar domain_password: Password of the domain the VM has to join. + :vartype domain_password: str + :ivar workgroup: Gets or sets the workgroup. + :vartype workgroup: str + :ivar product_key: Gets or sets the product key.Input format xxxxx-xxxxx-xxxxx-xxxxx-xxxxx. + :vartype product_key: str + :ivar timezone: Gets or sets the index value of the timezone. + :vartype timezone: int + :ivar run_once_commands: Get or sets the commands to be run once at the time of creation + separated by semicolons. + :vartype run_once_commands: str """ _validation = { @@ -1771,16 +1795,49 @@ class OsProfileForVmInstance(_serialization.Model): "os_type": {"key": "osType", "type": "str"}, "os_sku": {"key": "osSku", "type": "str"}, "os_version": {"key": "osVersion", "type": "str"}, + "domain_name": {"key": "domainName", "type": "str"}, + "domain_username": {"key": "domainUsername", "type": "str"}, + "domain_password": {"key": "domainPassword", "type": "str"}, + "workgroup": {"key": "workgroup", "type": "str"}, + "product_key": {"key": "productKey", "type": "str"}, + "timezone": {"key": "timezone", "type": "int"}, + "run_once_commands": {"key": "runOnceCommands", "type": "str"}, } def __init__( - self, *, admin_password: Optional[str] = None, computer_name: Optional[str] = None, **kwargs: Any + self, + *, + admin_password: Optional[str] = None, + computer_name: Optional[str] = None, + domain_name: Optional[str] = None, + domain_username: Optional[str] = None, + domain_password: Optional[str] = None, + workgroup: Optional[str] = None, + product_key: Optional[str] = None, + timezone: Optional[int] = None, + run_once_commands: Optional[str] = None, + **kwargs: Any ) -> None: """ :keyword admin_password: Admin password of the virtual machine. :paramtype admin_password: str :keyword computer_name: Gets or sets computer name. :paramtype computer_name: str + :keyword domain_name: Gets or sets the domain name. + :paramtype domain_name: str + :keyword domain_username: Gets or sets the domain username. + :paramtype domain_username: str + :keyword domain_password: Password of the domain the VM has to join. + :paramtype domain_password: str + :keyword workgroup: Gets or sets the workgroup. + :paramtype workgroup: str + :keyword product_key: Gets or sets the product key.Input format xxxxx-xxxxx-xxxxx-xxxxx-xxxxx. + :paramtype product_key: str + :keyword timezone: Gets or sets the index value of the timezone. + :paramtype timezone: int + :keyword run_once_commands: Get or sets the commands to be run once at the time of creation + separated by semicolons. + :paramtype run_once_commands: str """ super().__init__(**kwargs) self.admin_password = admin_password @@ -1788,6 +1845,13 @@ def __init__( self.os_type = None self.os_sku = None self.os_version = None + self.domain_name = domain_name + self.domain_username = domain_username + self.domain_password = domain_password + self.workgroup = workgroup + self.product_key = product_key + self.timezone = timezone + self.run_once_commands = run_once_commands class StopVirtualMachineOptions(_serialization.Model): diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_availability_sets_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_availability_sets_operations.py index 78032b3519e8..2aab047eb5e5 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_availability_sets_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_availability_sets_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 @@ -48,7 +48,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +72,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -104,7 +104,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -144,7 +144,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -187,7 +187,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -235,7 +235,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -323,7 +323,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -339,7 +338,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 @@ -406,7 +404,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 +419,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 @@ -491,7 +487,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -506,7 +501,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("AvailabilitySet", pipeline_response) + deserialized = self._deserialize("AvailabilitySet", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -519,7 +514,7 @@ def _create_or_update_initial( availability_set_resource_name: str, resource: Union[_models.AvailabilitySet, IO[bytes]], **kwargs: Any - ) -> _models.AvailabilitySet: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -533,7 +528,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.AvailabilitySet] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -554,10 +549,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 ) @@ -565,21 +560,22 @@ 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("AvailabilitySet", pipeline_response) - if response.status_code == 201: response_headers["Azure-AsyncOperation"] = self._deserialize( "str", response.headers.get("Azure-AsyncOperation") ) response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = self._deserialize("AvailabilitySet", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -692,10 +688,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("AvailabilitySet", pipeline_response) + deserialized = self._deserialize("AvailabilitySet", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -725,7 +722,7 @@ def _update_initial( availability_set_resource_name: str, properties: Union[_models.AvailabilitySetTagsUpdate, IO[bytes]], **kwargs: Any - ) -> Optional[_models.AvailabilitySet]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -739,7 +736,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.AvailabilitySet]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -760,10 +757,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 ) @@ -771,19 +768,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("AvailabilitySet", 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 @@ -895,10 +894,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("AvailabilitySet", pipeline_response) + deserialized = self._deserialize("AvailabilitySet", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -922,13 +922,13 @@ 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 + def _delete_initial( self, resource_group_name: str, availability_set_resource_name: str, force: Optional[Union[str, _models.ForceDelete]] = None, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -941,7 +941,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( resource_group_name=resource_group_name, @@ -952,10 +952,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 ) @@ -963,6 +963,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) @@ -975,8 +979,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( @@ -1011,7 +1019,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, availability_set_resource_name=availability_set_resource_name, force=force, @@ -1021,6 +1029,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_clouds_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_clouds_operations.py index 8009c7321485..25d7080d9cd4 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_clouds_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_clouds_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 @@ -48,7 +48,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +72,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -104,7 +104,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -139,7 +139,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -177,7 +177,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -220,7 +220,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -303,7 +303,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -319,7 +318,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -386,7 +384,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -402,7 +399,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -469,7 +465,6 @@ def get(self, resource_group_name: str, cloud_resource_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -484,7 +479,7 @@ def get(self, resource_group_name: str, cloud_resource_name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Cloud", pipeline_response) + deserialized = self._deserialize("Cloud", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -497,7 +492,7 @@ def _create_or_update_initial( cloud_resource_name: str, resource: Union[_models.Cloud, IO[bytes]], **kwargs: Any - ) -> _models.Cloud: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -511,7 +506,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.Cloud] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -532,10 +527,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 ) @@ -543,18 +538,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("Cloud", pipeline_response) - if response.status_code == 201: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = self._deserialize("Cloud", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -664,10 +660,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("Cloud", pipeline_response) + deserialized = self._deserialize("Cloud", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -697,7 +694,7 @@ def _update_initial( cloud_resource_name: str, properties: Union[_models.CloudTagsUpdate, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Cloud]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -711,7 +708,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.Cloud]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -732,10 +729,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 ) @@ -743,19 +740,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("Cloud", 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 @@ -864,10 +863,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("Cloud", pipeline_response) + deserialized = self._deserialize("Cloud", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -891,13 +891,13 @@ 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 + def _delete_initial( self, resource_group_name: str, cloud_resource_name: str, force: Optional[Union[str, _models.ForceDelete]] = None, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -910,7 +910,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( resource_group_name=resource_group_name, @@ -921,10 +921,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 ) @@ -932,6 +932,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) @@ -941,8 +945,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( @@ -977,7 +985,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, cloud_resource_name=cloud_resource_name, force=force, @@ -987,6 +995,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_guest_agents_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_guest_agents_operations.py index 4b14b6d08622..27cc37de3f7e 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_guest_agents_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_guest_agents_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 @@ -50,7 +50,7 @@ def build_list_by_virtual_machine_instance_request( # pylint: disable=name-too- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,7 +76,7 @@ def build_get_request(resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,7 +102,7 @@ def build_create_request(resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -131,7 +131,7 @@ def build_delete_request(resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -208,7 +208,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -224,7 +223,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 @@ -287,7 +285,6 @@ def get(self, resource_uri: str, **kwargs: Any) -> _models.GuestAgent: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -302,7 +299,7 @@ def get(self, resource_uri: str, **kwargs: Any) -> _models.GuestAgent: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("GuestAgent", pipeline_response) + deserialized = self._deserialize("GuestAgent", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -311,7 +308,7 @@ def get(self, resource_uri: str, **kwargs: Any) -> _models.GuestAgent: def _create_initial( self, resource_uri: str, resource: Union[_models.GuestAgent, IO[bytes]], **kwargs: Any - ) -> _models.GuestAgent: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -325,7 +322,7 @@ def _create_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.GuestAgent] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -344,10 +341,10 @@ def _create_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 ) @@ -355,18 +352,19 @@ def _create_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("GuestAgent", pipeline_response) - if response.status_code == 201: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = self._deserialize("GuestAgent", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -453,10 +451,11 @@ def begin_create( 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("GuestAgent", pipeline_response) + deserialized = self._deserialize("GuestAgent", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -513,7 +512,6 @@ def delete(self, resource_uri: str, **kwargs: Any) -> None: # pylint: disable=i headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_inventory_items_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_inventory_items_operations.py index 158fdd3b4ffd..14fac9d6e704 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_inventory_items_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_inventory_items_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 @@ -48,7 +46,7 @@ def build_list_by_vmm_server_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -87,7 +85,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -132,7 +130,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -180,7 +178,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -276,7 +274,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -292,7 +289,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -364,7 +360,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -379,7 +374,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("InventoryItem", pipeline_response) + deserialized = self._deserialize("InventoryItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -512,7 +507,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -527,11 +521,7 @@ def create( 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("InventoryItem", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("InventoryItem", pipeline_response) + deserialized = self._deserialize("InventoryItem", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -580,7 +570,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/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_operations.py index 123cb5f8b410..363110c9f8f9 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/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 @@ -45,7 +43,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -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/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_machine_instances_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_machine_instances_operations.py index 1ab3c410885c..4ae005109783 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_machine_instances_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_machine_instances_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 @@ -48,7 +48,7 @@ def build_list_request(resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +72,7 @@ def build_get_request(resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +96,7 @@ def build_create_or_update_request(resource_uri: str, **kwargs: Any) -> HttpRequ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -123,7 +123,7 @@ def build_update_request(resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -156,7 +156,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -184,7 +184,7 @@ def build_create_checkpoint_request(resource_uri: str, **kwargs: Any) -> HttpReq _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -213,7 +213,7 @@ def build_delete_checkpoint_request(resource_uri: str, **kwargs: Any) -> HttpReq _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -242,7 +242,7 @@ def build_restart_request(resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -268,7 +268,7 @@ def build_restore_checkpoint_request(resource_uri: str, **kwargs: Any) -> HttpRe _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -297,7 +297,7 @@ def build_start_request(resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -321,7 +321,7 @@ def build_stop_request(resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -400,7 +400,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -416,7 +415,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 @@ -479,7 +477,6 @@ def get(self, resource_uri: str, **kwargs: Any) -> _models.VirtualMachineInstanc headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -494,7 +491,7 @@ def get(self, resource_uri: str, **kwargs: Any) -> _models.VirtualMachineInstanc error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -503,7 +500,7 @@ def get(self, resource_uri: str, **kwargs: Any) -> _models.VirtualMachineInstanc def _create_or_update_initial( self, resource_uri: str, resource: Union[_models.VirtualMachineInstance, IO[bytes]], **kwargs: Any - ) -> _models.VirtualMachineInstance: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -517,7 +514,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.VirtualMachineInstance] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -536,10 +533,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 ) @@ -547,18 +544,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("VirtualMachineInstance", pipeline_response) - if response.status_code == 201: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -656,10 +654,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("VirtualMachineInstance", pipeline_response) + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -685,7 +684,7 @@ def get_long_running_output(pipeline_response): def _update_initial( self, resource_uri: str, properties: Union[_models.VirtualMachineInstanceUpdate, IO[bytes]], **kwargs: Any - ) -> Optional[_models.VirtualMachineInstance]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -699,7 +698,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.VirtualMachineInstance]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -718,10 +717,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 ) @@ -729,19 +728,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("VirtualMachineInstance", 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 @@ -835,10 +836,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("VirtualMachineInstance", pipeline_response) + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -862,13 +864,13 @@ 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 + def _delete_initial( self, resource_uri: str, force: Optional[Union[str, _models.ForceDelete]] = None, delete_from_host: Optional[Union[str, _models.DeleteFromHost]] = None, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -881,7 +883,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( resource_uri=resource_uri, @@ -891,10 +893,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 ) @@ -902,6 +904,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) @@ -911,8 +917,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( @@ -948,7 +958,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_uri=resource_uri, force=force, delete_from_host=delete_from_host, @@ -958,6 +968,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements @@ -981,9 +992,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _create_checkpoint_initial( # pylint: disable=inconsistent-return-statements + def _create_checkpoint_initial( self, resource_uri: str, body: Union[_models.VirtualMachineCreateCheckpoint, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -997,7 +1008,7 @@ def _create_checkpoint_initial( # pylint: disable=inconsistent-return-statement 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[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1016,10 +1027,10 @@ def _create_checkpoint_initial( # pylint: disable=inconsistent-return-statement 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 ) @@ -1027,6 +1038,10 @@ def _create_checkpoint_initial( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1035,8 +1050,12 @@ def _create_checkpoint_initial( # pylint: disable=inconsistent-return-statement 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 @overload def begin_create_checkpoint( @@ -1113,7 +1132,7 @@ def begin_create_checkpoint( 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._create_checkpoint_initial( # type: ignore + raw_result = self._create_checkpoint_initial( resource_uri=resource_uri, body=body, api_version=api_version, @@ -1123,6 +1142,7 @@ def begin_create_checkpoint( 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 @@ -1146,9 +1166,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _delete_checkpoint_initial( # pylint: disable=inconsistent-return-statements + def _delete_checkpoint_initial( self, resource_uri: str, body: Union[_models.VirtualMachineDeleteCheckpoint, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1162,7 +1182,7 @@ def _delete_checkpoint_initial( # pylint: disable=inconsistent-return-statement 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[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1181,10 +1201,10 @@ def _delete_checkpoint_initial( # pylint: disable=inconsistent-return-statement 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 ) @@ -1192,6 +1212,10 @@ def _delete_checkpoint_initial( # pylint: disable=inconsistent-return-statement response = pipeline_response.http_response if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1200,8 +1224,12 @@ def _delete_checkpoint_initial( # pylint: disable=inconsistent-return-statement 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 @overload def begin_delete_checkpoint( @@ -1278,7 +1306,7 @@ def begin_delete_checkpoint( 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_checkpoint_initial( # type: ignore + raw_result = self._delete_checkpoint_initial( resource_uri=resource_uri, body=body, api_version=api_version, @@ -1288,6 +1316,7 @@ def begin_delete_checkpoint( 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 @@ -1311,9 +1340,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restart_initial( # pylint: disable=inconsistent-return-statements - self, resource_uri: str, **kwargs: Any - ) -> None: + def _restart_initial(self, resource_uri: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1326,7 +1353,7 @@ def _restart_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_restart_request( resource_uri=resource_uri, @@ -1334,10 +1361,10 @@ def _restart_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 ) @@ -1345,6 +1372,10 @@ def _restart_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1353,8 +1384,12 @@ def _restart_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_restart(self, resource_uri: str, **kwargs: Any) -> LROPoller[None]: @@ -1378,7 +1413,7 @@ def begin_restart(self, resource_uri: 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._restart_initial( # type: ignore + raw_result = self._restart_initial( resource_uri=resource_uri, api_version=api_version, cls=lambda x, y, z: x, @@ -1386,6 +1421,7 @@ def begin_restart(self, resource_uri: 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 @@ -1409,9 +1445,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _restore_checkpoint_initial( # pylint: disable=inconsistent-return-statements + def _restore_checkpoint_initial( self, resource_uri: str, body: Union[_models.VirtualMachineRestoreCheckpoint, IO[bytes]], **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1425,7 +1461,7 @@ def _restore_checkpoint_initial( # pylint: disable=inconsistent-return-statemen 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[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1444,10 +1480,10 @@ def _restore_checkpoint_initial( # pylint: disable=inconsistent-return-statemen 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 ) @@ -1455,6 +1491,10 @@ def _restore_checkpoint_initial( # pylint: disable=inconsistent-return-statemen response = pipeline_response.http_response if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1463,8 +1503,12 @@ def _restore_checkpoint_initial( # pylint: disable=inconsistent-return-statemen 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 @overload def begin_restore_checkpoint( @@ -1541,7 +1585,7 @@ def begin_restore_checkpoint( 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._restore_checkpoint_initial( # type: ignore + raw_result = self._restore_checkpoint_initial( resource_uri=resource_uri, body=body, api_version=api_version, @@ -1551,6 +1595,7 @@ def begin_restore_checkpoint( 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 @@ -1574,9 +1619,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _start_initial( # pylint: disable=inconsistent-return-statements - self, resource_uri: str, **kwargs: Any - ) -> None: + def _start_initial(self, resource_uri: str, **kwargs: Any) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1589,7 +1632,7 @@ def _start_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_start_request( resource_uri=resource_uri, @@ -1597,10 +1640,10 @@ def _start_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 ) @@ -1608,6 +1651,10 @@ def _start_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1616,8 +1663,12 @@ def _start_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_start(self, resource_uri: str, **kwargs: Any) -> LROPoller[None]: @@ -1641,7 +1692,7 @@ def begin_start(self, resource_uri: 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._start_initial( # type: ignore + raw_result = self._start_initial( resource_uri=resource_uri, api_version=api_version, cls=lambda x, y, z: x, @@ -1649,6 +1700,7 @@ def begin_start(self, resource_uri: 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 @@ -1672,9 +1724,12 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _stop_initial( # pylint: disable=inconsistent-return-statements - self, resource_uri: str, body: Union[_models.StopVirtualMachineOptions, IO[bytes]], **kwargs: Any - ) -> None: + def _stop_initial( + self, + resource_uri: str, + body: Optional[Union[_models.StopVirtualMachineOptions, IO[bytes]]] = None, + **kwargs: Any + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -1688,7 +1743,7 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements 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[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1696,7 +1751,10 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements if isinstance(body, (IOBase, bytes)): _content = body else: - _json = self._serialize.body(body, "StopVirtualMachineOptions") + if body is not None: + _json = self._serialize.body(body, "StopVirtualMachineOptions") + else: + _json = None _request = build_stop_request( resource_uri=resource_uri, @@ -1707,10 +1765,10 @@ def _stop_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 ) @@ -1718,6 +1776,10 @@ def _stop_initial( # pylint: disable=inconsistent-return-statements response = pipeline_response.http_response if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -1726,14 +1788,18 @@ def _stop_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 @overload def begin_stop( self, resource_uri: str, - body: _models.StopVirtualMachineOptions, + body: Optional[_models.StopVirtualMachineOptions] = None, *, content_type: str = "application/json", **kwargs: Any @@ -1745,7 +1811,7 @@ def begin_stop( :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. Required. :type resource_uri: str - :param body: The content of the action request. Required. + :param body: The content of the action request. Default value is None. :type body: ~azure.mgmt.scvmm.models.StopVirtualMachineOptions :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -1757,7 +1823,12 @@ def begin_stop( @overload def begin_stop( - self, resource_uri: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + self, + resource_uri: str, + body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any ) -> LROPoller[None]: """Implements the operation to stop a virtual machine. @@ -1766,7 +1837,7 @@ def begin_stop( :param resource_uri: The fully qualified Azure Resource manager identifier of the resource. Required. :type resource_uri: str - :param body: The content of the action request. Required. + :param body: The content of the action request. Default value is None. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -1778,7 +1849,10 @@ def begin_stop( @distributed_trace def begin_stop( - self, resource_uri: str, body: Union[_models.StopVirtualMachineOptions, IO[bytes]], **kwargs: Any + self, + resource_uri: str, + body: Optional[Union[_models.StopVirtualMachineOptions, IO[bytes]]] = None, + **kwargs: Any ) -> LROPoller[None]: """Implements the operation to stop a virtual machine. @@ -1788,7 +1862,7 @@ def begin_stop( Required. :type resource_uri: str :param body: The content of the action request. Is either a StopVirtualMachineOptions type or a - IO[bytes] type. Required. + IO[bytes] type. Default value is None. :type body: ~azure.mgmt.scvmm.models.StopVirtualMachineOptions or IO[bytes] :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] @@ -1804,7 +1878,7 @@ def begin_stop( 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._stop_initial( # type: ignore + raw_result = self._stop_initial( resource_uri=resource_uri, body=body, api_version=api_version, @@ -1814,6 +1888,7 @@ def begin_stop( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_machine_templates_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_machine_templates_operations.py index 94629bb92198..60378b1d309e 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_machine_templates_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_machine_templates_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 @@ -48,7 +48,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -74,7 +74,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -106,7 +106,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -146,7 +146,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -189,7 +189,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -237,7 +237,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -326,7 +326,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -342,7 +341,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 @@ -412,7 +410,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -428,7 +425,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -497,7 +493,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -512,7 +507,7 @@ def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualMachineTemplate", pipeline_response) + deserialized = self._deserialize("VirtualMachineTemplate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -525,7 +520,7 @@ def _create_or_update_initial( virtual_machine_template_name: str, resource: Union[_models.VirtualMachineTemplate, IO[bytes]], **kwargs: Any - ) -> _models.VirtualMachineTemplate: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -539,7 +534,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.VirtualMachineTemplate] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -560,10 +555,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 ) @@ -571,18 +566,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("VirtualMachineTemplate", pipeline_response) - if response.status_code == 201: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = self._deserialize("VirtualMachineTemplate", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -695,10 +691,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("VirtualMachineTemplate", pipeline_response) + deserialized = self._deserialize("VirtualMachineTemplate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -728,7 +725,7 @@ def _update_initial( virtual_machine_template_name: str, properties: Union[_models.VirtualMachineTemplateTagsUpdate, IO[bytes]], **kwargs: Any - ) -> Optional[_models.VirtualMachineTemplate]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -742,7 +739,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.VirtualMachineTemplate]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -763,10 +760,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 ) @@ -774,19 +771,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("VirtualMachineTemplate", 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 @@ -898,10 +897,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("VirtualMachineTemplate", pipeline_response) + deserialized = self._deserialize("VirtualMachineTemplate", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -925,13 +925,13 @@ 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 + def _delete_initial( self, resource_group_name: str, virtual_machine_template_name: str, force: Optional[Union[str, _models.ForceDelete]] = None, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -944,7 +944,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( resource_group_name=resource_group_name, @@ -955,10 +955,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 ) @@ -966,6 +966,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) @@ -975,8 +979,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( @@ -1011,7 +1019,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, virtual_machine_template_name=virtual_machine_template_name, force=force, @@ -1021,6 +1029,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_networks_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_networks_operations.py index c5a6133e70e0..67a6a5ecfba6 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_networks_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_virtual_networks_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 @@ -48,7 +48,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +72,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -104,7 +104,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -139,7 +139,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -177,7 +177,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -220,7 +220,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -303,7 +303,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -319,7 +318,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -386,7 +384,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -402,7 +399,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -469,7 +465,6 @@ def get(self, resource_group_name: str, virtual_network_name: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -484,7 +479,7 @@ def get(self, resource_group_name: str, virtual_network_name: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualNetwork", pipeline_response) + deserialized = self._deserialize("VirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -497,7 +492,7 @@ def _create_or_update_initial( virtual_network_name: str, resource: Union[_models.VirtualNetwork, IO[bytes]], **kwargs: Any - ) -> _models.VirtualNetwork: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -511,7 +506,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.VirtualNetwork] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -532,10 +527,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 ) @@ -543,18 +538,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("VirtualNetwork", pipeline_response) - if response.status_code == 201: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = self._deserialize("VirtualNetwork", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -667,10 +663,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("VirtualNetwork", pipeline_response) + deserialized = self._deserialize("VirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -700,7 +697,7 @@ def _update_initial( virtual_network_name: str, properties: Union[_models.VirtualNetworkTagsUpdate, IO[bytes]], **kwargs: Any - ) -> Optional[_models.VirtualNetwork]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -714,7 +711,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.VirtualNetwork]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -735,10 +732,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 ) @@ -746,19 +743,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("VirtualNetwork", 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 +869,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("VirtualNetwork", pipeline_response) + deserialized = self._deserialize("VirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -897,13 +897,13 @@ 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 + def _delete_initial( self, resource_group_name: str, virtual_network_name: str, force: Optional[Union[str, _models.ForceDelete]] = None, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -916,7 +916,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( resource_group_name=resource_group_name, @@ -927,10 +927,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 ) @@ -938,6 +938,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) @@ -947,8 +951,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( @@ -983,7 +991,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, virtual_network_name=virtual_network_name, force=force, @@ -993,6 +1001,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_vm_instance_hybrid_identity_metadatas_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_vm_instance_hybrid_identity_metadatas_operations.py index 4d0b5bdc4e03..16b348d9dfc9 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_vm_instance_hybrid_identity_metadatas_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_vm_instance_hybrid_identity_metadatas_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 @@ -47,7 +45,7 @@ def build_list_by_virtual_machine_instance_request( # pylint: disable=name-too- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -74,7 +72,7 @@ def build_get_request(resource_uri: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -155,7 +153,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -171,7 +168,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 @@ -234,7 +230,6 @@ def get(self, resource_uri: str, **kwargs: Any) -> _models.VmInstanceHybridIdent headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -249,7 +244,7 @@ def get(self, resource_uri: str, **kwargs: Any) -> _models.VmInstanceHybridIdent error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VmInstanceHybridIdentityMetadata", pipeline_response) + deserialized = self._deserialize("VmInstanceHybridIdentityMetadata", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_vmm_servers_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_vmm_servers_operations.py index 24f331dca50c..7056b3872500 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_vmm_servers_operations.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/_vmm_servers_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 @@ -48,7 +48,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +72,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -104,7 +104,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -139,7 +139,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -177,7 +177,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -220,7 +220,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-07")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -303,7 +303,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -319,7 +318,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -386,7 +384,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -402,7 +399,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -469,7 +465,6 @@ def get(self, resource_group_name: str, vmm_server_name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -484,7 +479,7 @@ def get(self, resource_group_name: str, vmm_server_name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VmmServer", pipeline_response) + deserialized = self._deserialize("VmmServer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -497,7 +492,7 @@ def _create_or_update_initial( vmm_server_name: str, resource: Union[_models.VmmServer, IO[bytes]], **kwargs: Any - ) -> _models.VmmServer: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -511,7 +506,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.VmmServer] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -532,10 +527,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 ) @@ -543,18 +538,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("VmmServer", pipeline_response) - if response.status_code == 201: response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - deserialized = self._deserialize("VmmServer", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -664,10 +660,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("VmmServer", pipeline_response) + deserialized = self._deserialize("VmmServer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -697,7 +694,7 @@ def _update_initial( vmm_server_name: str, properties: Union[_models.VmmServerTagsUpdate, IO[bytes]], **kwargs: Any - ) -> Optional[_models.VmmServer]: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -711,7 +708,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.VmmServer]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -732,10 +729,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 ) @@ -743,19 +740,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("VmmServer", 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 @@ -864,10 +863,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("VmmServer", pipeline_response) + deserialized = self._deserialize("VmmServer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -891,13 +891,13 @@ 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 + def _delete_initial( self, resource_group_name: str, vmm_server_name: str, force: Optional[Union[str, _models.ForceDelete]] = None, **kwargs: Any - ) -> None: + ) -> Iterator[bytes]: error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -910,7 +910,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( resource_group_name=resource_group_name, @@ -921,10 +921,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 ) @@ -932,6 +932,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) @@ -941,8 +945,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( @@ -977,7 +985,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, vmm_server_name=vmm_server_name, force=force, @@ -987,6 +995,7 @@ def begin_delete( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_create_or_update_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_create_or_update_maximum_set_gen.py index 3e7a52d9573c..67780687ae0e 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_create_or_update_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_create_or_update_maximum_set_gen.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.scvmm import ScVmmMgmtClient @@ -51,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/AvailabilitySets_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/AvailabilitySets_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_create_or_update_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_create_or_update_minimum_set_gen.py index 4d8a71606901..8bab5087c1fb 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_create_or_update_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_create_or_update_minimum_set_gen.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.scvmm import ScVmmMgmtClient @@ -40,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/AvailabilitySets_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/AvailabilitySets_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_delete_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_delete_maximum_set_gen.py index e069458fbbb1..96c93aab0814 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_delete_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_delete_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/AvailabilitySets_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/AvailabilitySets_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_delete_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_delete_minimum_set_gen.py index 4b31ebf071b8..9bffaa4b171a 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_delete_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_delete_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/AvailabilitySets_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/AvailabilitySets_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_get_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_get_maximum_set_gen.py index b4f65cc94bc4..25a3e1e9c2db 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_get_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_get_maximum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/AvailabilitySets_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/AvailabilitySets_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_get_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_get_minimum_set_gen.py index 3e209312e9c7..87a826c9c19a 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_get_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_get_minimum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/AvailabilitySets_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/AvailabilitySets_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_list_by_resource_group_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_list_by_resource_group_maximum_set_gen.py index f5828d29db39..eb1a0ebf48ff 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_list_by_resource_group_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_list_by_resource_group_maximum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/AvailabilitySets_ListByResourceGroup_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/AvailabilitySets_ListByResourceGroup_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_list_by_resource_group_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_list_by_resource_group_minimum_set_gen.py index 1cc3b1e7fe34..2d6446b19ab7 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_list_by_resource_group_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_list_by_resource_group_minimum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/AvailabilitySets_ListByResourceGroup_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/AvailabilitySets_ListByResourceGroup_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_list_by_subscription_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_list_by_subscription_maximum_set_gen.py index d5beedbc1ef5..45f59e5aa788 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_list_by_subscription_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_list_by_subscription_maximum_set_gen.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/AvailabilitySets_ListBySubscription_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/AvailabilitySets_ListBySubscription_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_list_by_subscription_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_list_by_subscription_minimum_set_gen.py index 83fced1e3012..b28cfb154d44 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_list_by_subscription_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_list_by_subscription_minimum_set_gen.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/AvailabilitySets_ListBySubscription_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/AvailabilitySets_ListBySubscription_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_update_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_update_maximum_set_gen.py index da8b48387282..bbd4e95a7006 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_update_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/availability_sets_update_maximum_set_gen.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.scvmm import ScVmmMgmtClient @@ -40,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/AvailabilitySets_Update_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/AvailabilitySets_Update_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_create_or_update_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_create_or_update_maximum_set_gen.py index 1943bdc09484..e75059b82032 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_create_or_update_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_create_or_update_maximum_set_gen.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.scvmm import ScVmmMgmtClient @@ -53,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/Clouds_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/Clouds_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_create_or_update_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_create_or_update_minimum_set_gen.py index 3df9c8772250..fec2d62a3e07 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_create_or_update_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_create_or_update_minimum_set_gen.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.scvmm import ScVmmMgmtClient @@ -40,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/Clouds_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/Clouds_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_delete_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_delete_maximum_set_gen.py index 15ab1eab35d8..451c1ef60ef9 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_delete_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_delete_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/Clouds_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/Clouds_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_delete_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_delete_minimum_set_gen.py index 7013f18ea3c4..12553a9bf14b 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_delete_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_delete_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/Clouds_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/Clouds_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_get_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_get_maximum_set_gen.py index 2c79b6dc39d3..072a34a65ce9 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_get_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_get_maximum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/Clouds_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/Clouds_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_get_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_get_minimum_set_gen.py index 37fee2f60129..58b6bf6d4199 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_get_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_get_minimum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/Clouds_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/Clouds_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_list_by_resource_group_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_list_by_resource_group_maximum_set_gen.py index 4d91ee1d80cd..24d799c6d86f 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_list_by_resource_group_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_list_by_resource_group_maximum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/Clouds_ListByResourceGroup_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/Clouds_ListByResourceGroup_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_list_by_resource_group_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_list_by_resource_group_minimum_set_gen.py index d98526105284..a27c6b1a3fd3 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_list_by_resource_group_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_list_by_resource_group_minimum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/Clouds_ListByResourceGroup_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/Clouds_ListByResourceGroup_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_list_by_subscription_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_list_by_subscription_maximum_set_gen.py index a26587ee9122..f9293ca601a5 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_list_by_subscription_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_list_by_subscription_maximum_set_gen.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/Clouds_ListBySubscription_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/Clouds_ListBySubscription_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_list_by_subscription_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_list_by_subscription_minimum_set_gen.py index 0b89ec8c86b4..0099296ab0b0 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_list_by_subscription_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_list_by_subscription_minimum_set_gen.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/Clouds_ListBySubscription_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/Clouds_ListBySubscription_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_update_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_update_maximum_set_gen.py index 7de2113cf73f..f2e9f49d4a9a 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_update_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/clouds_update_maximum_set_gen.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.scvmm import ScVmmMgmtClient @@ -40,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/Clouds_Update_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/Clouds_Update_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/guest_agents_create_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/guest_agents_create_maximum_set_gen.py index 30c8f33f25c1..6c795f69166b 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/guest_agents_create_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/guest_agents_create_maximum_set_gen.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.scvmm import ScVmmMgmtClient @@ -45,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/GuestAgents_Create_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/GuestAgents_Create_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/guest_agents_delete_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/guest_agents_delete_maximum_set_gen.py index 24e0df2fa152..4ff48a8cc457 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/guest_agents_delete_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/guest_agents_delete_maximum_set_gen.py @@ -35,6 +35,6 @@ def main(): ) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/GuestAgents_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/GuestAgents_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/guest_agents_delete_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/guest_agents_delete_minimum_set_gen.py index 828af8c6bccd..2ef0859862e3 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/guest_agents_delete_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/guest_agents_delete_minimum_set_gen.py @@ -35,6 +35,6 @@ def main(): ) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/GuestAgents_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/GuestAgents_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/guest_agents_get_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/guest_agents_get_maximum_set_gen.py index ded33d2838cc..0d135780a10b 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/guest_agents_get_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/guest_agents_get_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/GuestAgents_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/GuestAgents_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/guest_agents_get_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/guest_agents_get_minimum_set_gen.py index 9d71ef92cf61..53e4068cf33a 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/guest_agents_get_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/guest_agents_get_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/GuestAgents_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/GuestAgents_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/guest_agents_list_by_virtual_machine_instance_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/guest_agents_list_by_virtual_machine_instance_maximum_set_gen.py index 87ac057ee3f4..bcd98dc9cce4 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/guest_agents_list_by_virtual_machine_instance_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/guest_agents_list_by_virtual_machine_instance_maximum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/GuestAgents_ListByVirtualMachineInstance_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/GuestAgents_ListByVirtualMachineInstance_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/guest_agents_list_by_virtual_machine_instance_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/guest_agents_list_by_virtual_machine_instance_minimum_set_gen.py index 0468b63fa15c..eb490698609a 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/guest_agents_list_by_virtual_machine_instance_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/guest_agents_list_by_virtual_machine_instance_minimum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/GuestAgents_ListByVirtualMachineInstance_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/GuestAgents_ListByVirtualMachineInstance_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/inventory_items_create_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/inventory_items_create_maximum_set_gen.py index a8c3447be1c8..d33de24b244e 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/inventory_items_create_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/inventory_items_create_maximum_set_gen.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.scvmm import ScVmmMgmtClient @@ -41,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/InventoryItems_Create_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/InventoryItems_Create_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/inventory_items_delete_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/inventory_items_delete_maximum_set_gen.py index 4e85fbbb588a..66a32109e3f9 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/inventory_items_delete_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/inventory_items_delete_maximum_set_gen.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/InventoryItems_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/InventoryItems_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/inventory_items_delete_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/inventory_items_delete_minimum_set_gen.py index a6e301810143..d65a5f4474c4 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/inventory_items_delete_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/inventory_items_delete_minimum_set_gen.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/InventoryItems_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/InventoryItems_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/inventory_items_get_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/inventory_items_get_maximum_set_gen.py index a400fd5df91e..09278cd73c1f 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/inventory_items_get_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/inventory_items_get_maximum_set_gen.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/InventoryItems_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/InventoryItems_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/inventory_items_get_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/inventory_items_get_minimum_set_gen.py index 5d206d59c95b..7e1630ab0f07 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/inventory_items_get_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/inventory_items_get_minimum_set_gen.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/InventoryItems_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/InventoryItems_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/inventory_items_list_by_vmm_server_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/inventory_items_list_by_vmm_server_maximum_set_gen.py index 67fad2f04b48..d20b22982eec 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/inventory_items_list_by_vmm_server_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/inventory_items_list_by_vmm_server_maximum_set_gen.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/InventoryItems_ListByVmmServer_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/InventoryItems_ListByVmmServer_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/inventory_items_list_by_vmm_server_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/inventory_items_list_by_vmm_server_minimum_set_gen.py index cbccc349a8fa..dde7f8a42d55 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/inventory_items_list_by_vmm_server_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/inventory_items_list_by_vmm_server_minimum_set_gen.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/InventoryItems_ListByVmmServer_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/InventoryItems_ListByVmmServer_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/operations_list_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/operations_list_maximum_set_gen.py index bd3aabab2f02..4c3235904ed9 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/operations_list_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/operations_list_maximum_set_gen.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/Operations_List_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/Operations_List_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/operations_list_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/operations_list_minimum_set_gen.py index 90517f62540d..113622cfb90f 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/operations_list_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/operations_list_minimum_set_gen.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/Operations_List_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/Operations_List_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_create_checkpoint_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_create_checkpoint_maximum_set_gen.py index 5b2ad2dbf8c3..e866a313bc30 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_create_checkpoint_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_create_checkpoint_maximum_set_gen.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.scvmm import ScVmmMgmtClient @@ -38,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_CreateCheckpoint_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualMachineInstances_CreateCheckpoint_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_create_or_update_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_create_or_update_maximum_set_gen.py index 0eedf7d96281..2ed8ffb0bbc8 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_create_or_update_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_create_or_update_maximum_set_gen.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.scvmm import ScVmmMgmtClient @@ -88,7 +86,14 @@ def main(): "osProfile": { "adminPassword": "vavtppmmhlspydtkzxda", "computerName": "uuxpcxuxcufllc", + "domainName": "vblzsoqxzlrygdulnefexjdezo", + "domainPassword": "ixbwja", + "domainUsername": "sn", "osType": "Windows", + "productKey": "12345-12345-12345-12345-12345", + "runOnceCommands": "byxpnluptiwxycbbybsf;qwerty", + "timezone": 4, + "workgroup": "bsqftibgcnnjpvmuxligk", }, "storageProfile": { "disks": [ @@ -112,6 +117,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualMachineInstances_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_create_or_update_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_create_or_update_minimum_set_gen.py index f1312c50c3e2..5e4f496d8af4 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_create_or_update_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_create_or_update_minimum_set_gen.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.scvmm import ScVmmMgmtClient @@ -39,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualMachineInstances_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_delete_checkpoint_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_delete_checkpoint_maximum_set_gen.py index efd7a136f6f3..b2e8b855079d 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_delete_checkpoint_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_delete_checkpoint_maximum_set_gen.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.scvmm import ScVmmMgmtClient @@ -38,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_DeleteCheckpoint_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualMachineInstances_DeleteCheckpoint_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_delete_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_delete_maximum_set_gen.py index 920560e88e2b..bd8dd4c635cf 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_delete_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_delete_maximum_set_gen.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualMachineInstances_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_delete_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_delete_minimum_set_gen.py index 1304c2986675..69a619165d3b 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_delete_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_delete_minimum_set_gen.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualMachineInstances_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_get_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_get_maximum_set_gen.py index d4a2d9a58d7c..7305a682b30d 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_get_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_get_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualMachineInstances_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_get_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_get_minimum_set_gen.py index 34751e824510..824a243cbb29 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_get_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_get_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualMachineInstances_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_list_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_list_maximum_set_gen.py index d40851a5260a..7f7aacfce204 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_list_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_list_maximum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_List_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualMachineInstances_List_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_list_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_list_minimum_set_gen.py index 4337d6efff74..7202a339fdea 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_list_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_list_minimum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_List_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualMachineInstances_List_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_restart_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_restart_maximum_set_gen.py index 0062e3417f55..3608b5db0c11 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_restart_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_restart_maximum_set_gen.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_Restart_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualMachineInstances_Restart_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_restart_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_restart_minimum_set_gen.py index e800490dfdc8..5db11be4d7f1 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_restart_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_restart_minimum_set_gen.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_Restart_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualMachineInstances_Restart_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_restore_checkpoint_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_restore_checkpoint_maximum_set_gen.py index adfdd15c9e10..800df127b367 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_restore_checkpoint_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_restore_checkpoint_maximum_set_gen.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.scvmm import ScVmmMgmtClient @@ -38,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_RestoreCheckpoint_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualMachineInstances_RestoreCheckpoint_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_start_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_start_maximum_set_gen.py index 805bfe25494c..e7006bef265b 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_start_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_start_maximum_set_gen.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_Start_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualMachineInstances_Start_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_start_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_start_minimum_set_gen.py index dcf7395ed794..d27c7dd29e24 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_start_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_start_minimum_set_gen.py @@ -35,6 +35,6 @@ def main(): ).result() -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_Start_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualMachineInstances_Start_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_stop_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_stop_maximum_set_gen.py index e83cdb279335..46bf0991200c 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_stop_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_stop_maximum_set_gen.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.scvmm import ScVmmMgmtClient @@ -34,10 +32,9 @@ def main(): client.virtual_machine_instances.begin_stop( resource_uri="gtgclehcbsyave", - body={"skipShutdown": "true"}, ).result() -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_Stop_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualMachineInstances_Stop_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_stop_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_stop_minimum_set_gen.py new file mode 100644 index 000000000000..cc8452528494 --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_stop_minimum_set_gen.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.scvmm import ScVmmMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-scvmm +# USAGE + python virtual_machine_instances_stop_minimum_set_gen.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = ScVmmMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.virtual_machine_instances.begin_stop( + resource_uri="gtgclehcbsyave", + ).result() + + +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualMachineInstances_Stop_MinimumSet_Gen.json +if __name__ == "__main__": + main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_update_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_update_maximum_set_gen.py index da8e321e4022..220f34261afe 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_update_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_update_maximum_set_gen.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.scvmm import ScVmmMgmtClient @@ -84,6 +82,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_Update_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualMachineInstances_Update_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_create_or_update_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_create_or_update_maximum_set_gen.py index fff60ea6e9c4..058e047e50c8 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_create_or_update_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_create_or_update_maximum_set_gen.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.scvmm import ScVmmMgmtClient @@ -57,6 +55,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineTemplates_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualMachineTemplates_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_create_or_update_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_create_or_update_minimum_set_gen.py index 6ca93cae113a..4bf0cd1a19e6 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_create_or_update_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_create_or_update_minimum_set_gen.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.scvmm import ScVmmMgmtClient @@ -40,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineTemplates_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualMachineTemplates_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_delete_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_delete_maximum_set_gen.py index cb8046dbaab7..951c00d245a7 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_delete_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_delete_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineTemplates_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualMachineTemplates_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_delete_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_delete_minimum_set_gen.py index 5d82a72b0713..f4c94513a38f 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_delete_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_delete_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineTemplates_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualMachineTemplates_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_get_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_get_maximum_set_gen.py index 98be1c10fcb3..1b5f702e9d25 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_get_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_get_maximum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineTemplates_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualMachineTemplates_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_get_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_get_minimum_set_gen.py index 04980c368067..0240b2802049 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_get_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_get_minimum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineTemplates_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualMachineTemplates_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_list_by_resource_group_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_list_by_resource_group_maximum_set_gen.py index 8d6d6ae0f351..1105f74a3b90 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_list_by_resource_group_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_list_by_resource_group_maximum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineTemplates_ListByResourceGroup_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualMachineTemplates_ListByResourceGroup_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_list_by_resource_group_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_list_by_resource_group_minimum_set_gen.py index d121ba9bb50b..46a677d17bec 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_list_by_resource_group_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_list_by_resource_group_minimum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineTemplates_ListByResourceGroup_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualMachineTemplates_ListByResourceGroup_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_list_by_subscription_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_list_by_subscription_maximum_set_gen.py index 5ded6a794e58..ae07e6df7f8d 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_list_by_subscription_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_list_by_subscription_maximum_set_gen.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineTemplates_ListBySubscription_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualMachineTemplates_ListBySubscription_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_list_by_subscription_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_list_by_subscription_minimum_set_gen.py index 33b80d8d4012..2005a6788be3 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_list_by_subscription_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_list_by_subscription_minimum_set_gen.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineTemplates_ListBySubscription_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualMachineTemplates_ListBySubscription_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_update_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_update_maximum_set_gen.py index 087a6a01522f..2275ee7bd9f8 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_update_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_templates_update_maximum_set_gen.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.scvmm import ScVmmMgmtClient @@ -40,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineTemplates_Update_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualMachineTemplates_Update_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_create_or_update_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_create_or_update_maximum_set_gen.py index 40a91f48c2c3..a526de1949ed 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_create_or_update_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_create_or_update_maximum_set_gen.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.scvmm import ScVmmMgmtClient @@ -52,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualNetworks_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualNetworks_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_create_or_update_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_create_or_update_minimum_set_gen.py index 3b6f105e0e82..661964033902 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_create_or_update_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_create_or_update_minimum_set_gen.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.scvmm import ScVmmMgmtClient @@ -40,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualNetworks_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualNetworks_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_delete_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_delete_maximum_set_gen.py index 0f2c800c4d4f..1db09ee7ddfa 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_delete_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_delete_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualNetworks_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualNetworks_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_delete_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_delete_minimum_set_gen.py index bdbff47dd952..aa9420e8e5ec 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_delete_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_delete_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualNetworks_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualNetworks_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_get_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_get_maximum_set_gen.py index f704fd13576c..1429f847d915 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_get_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_get_maximum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualNetworks_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualNetworks_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_get_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_get_minimum_set_gen.py index ce61b4847bbc..8d172ccb9723 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_get_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_get_minimum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualNetworks_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualNetworks_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_list_by_resource_group_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_list_by_resource_group_maximum_set_gen.py index f2a644bd936b..8825244a3611 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_list_by_resource_group_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_list_by_resource_group_maximum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualNetworks_ListByResourceGroup_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualNetworks_ListByResourceGroup_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_list_by_resource_group_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_list_by_resource_group_minimum_set_gen.py index 86e41bbeff0a..b8c2687d6e05 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_list_by_resource_group_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_list_by_resource_group_minimum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualNetworks_ListByResourceGroup_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualNetworks_ListByResourceGroup_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_list_by_subscription_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_list_by_subscription_maximum_set_gen.py index 565e57c8f28d..56b118ff8c6e 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_list_by_subscription_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_list_by_subscription_maximum_set_gen.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualNetworks_ListBySubscription_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualNetworks_ListBySubscription_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_list_by_subscription_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_list_by_subscription_minimum_set_gen.py index 4717fe1684b1..c03b2c2c3c5e 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_list_by_subscription_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_list_by_subscription_minimum_set_gen.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualNetworks_ListBySubscription_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualNetworks_ListBySubscription_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_update_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_update_maximum_set_gen.py index 82be0ce6a6db..8882f23ddeac 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_update_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_networks_update_maximum_set_gen.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.scvmm import ScVmmMgmtClient @@ -40,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualNetworks_Update_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VirtualNetworks_Update_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vm_instance_hybrid_identity_metadatas_get_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vm_instance_hybrid_identity_metadatas_get_maximum_set_gen.py index 4594a8933637..92b4c8deb57c 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vm_instance_hybrid_identity_metadatas_get_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vm_instance_hybrid_identity_metadatas_get_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VmInstanceHybridIdentityMetadatas_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VmInstanceHybridIdentityMetadatas_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vm_instance_hybrid_identity_metadatas_get_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vm_instance_hybrid_identity_metadatas_get_minimum_set_gen.py index 70e6b2216414..6d500eaf1cc7 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vm_instance_hybrid_identity_metadatas_get_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vm_instance_hybrid_identity_metadatas_get_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VmInstanceHybridIdentityMetadatas_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VmInstanceHybridIdentityMetadatas_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vm_instance_hybrid_identity_metadatas_list_by_virtual_machine_instance_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vm_instance_hybrid_identity_metadatas_list_by_virtual_machine_instance_maximum_set_gen.py index c7f226e34395..151004e9cb0d 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vm_instance_hybrid_identity_metadatas_list_by_virtual_machine_instance_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vm_instance_hybrid_identity_metadatas_list_by_virtual_machine_instance_maximum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VmInstanceHybridIdentityMetadatas_ListByVirtualMachineInstance_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VmInstanceHybridIdentityMetadatas_ListByVirtualMachineInstance_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vm_instance_hybrid_identity_metadatas_list_by_virtual_machine_instance_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vm_instance_hybrid_identity_metadatas_list_by_virtual_machine_instance_minimum_set_gen.py index 5ce0b43123a7..039b8287bf0a 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vm_instance_hybrid_identity_metadatas_list_by_virtual_machine_instance_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vm_instance_hybrid_identity_metadatas_list_by_virtual_machine_instance_minimum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VmInstanceHybridIdentityMetadatas_ListByVirtualMachineInstance_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VmInstanceHybridIdentityMetadatas_ListByVirtualMachineInstance_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_create_or_update_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_create_or_update_maximum_set_gen.py index ee1b13c6a3ba..b37d96acc66b 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_create_or_update_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_create_or_update_maximum_set_gen.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.scvmm import ScVmmMgmtClient @@ -52,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VmmServers_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VmmServers_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_create_or_update_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_create_or_update_minimum_set_gen.py index 3c061224dad5..1df632e1e99a 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_create_or_update_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_create_or_update_minimum_set_gen.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.scvmm import ScVmmMgmtClient @@ -40,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VmmServers_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VmmServers_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_delete_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_delete_maximum_set_gen.py index 2be8fa2b38e1..34abcfece23d 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_delete_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_delete_maximum_set_gen.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VmmServers_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VmmServers_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_delete_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_delete_minimum_set_gen.py index c3b860941473..a0df1344de04 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_delete_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_delete_minimum_set_gen.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VmmServers_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VmmServers_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_get_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_get_maximum_set_gen.py index 2a407844c980..0a6f7fe2bc04 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_get_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_get_maximum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VmmServers_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VmmServers_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_get_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_get_minimum_set_gen.py index df877e760db1..55fc38815f8e 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_get_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_get_minimum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VmmServers_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VmmServers_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_list_by_resource_group_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_list_by_resource_group_maximum_set_gen.py index 9d0e3a92e281..8e2fa9dd2ac4 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_list_by_resource_group_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_list_by_resource_group_maximum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VmmServers_ListByResourceGroup_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VmmServers_ListByResourceGroup_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_list_by_resource_group_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_list_by_resource_group_minimum_set_gen.py index 83c780e4d6f2..ee6732b337ff 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_list_by_resource_group_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_list_by_resource_group_minimum_set_gen.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VmmServers_ListByResourceGroup_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VmmServers_ListByResourceGroup_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_list_by_subscription_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_list_by_subscription_maximum_set_gen.py index de4ebbb5d329..8b1bbcdf437c 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_list_by_subscription_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_list_by_subscription_maximum_set_gen.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VmmServers_ListBySubscription_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VmmServers_ListBySubscription_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_list_by_subscription_minimum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_list_by_subscription_minimum_set_gen.py index 8743f72ff361..d51cc6749f81 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_list_by_subscription_minimum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_list_by_subscription_minimum_set_gen.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VmmServers_ListBySubscription_MinimumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VmmServers_ListBySubscription_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_update_maximum_set_gen.py b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_update_maximum_set_gen.py index 179d50f5c143..cacea60d8266 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_update_maximum_set_gen.py +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/vmm_servers_update_maximum_set_gen.py @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.scvmm import ScVmmMgmtClient @@ -40,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VmmServers_Update_MaximumSet_Gen.json +# x-ms-original-file: specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2024-06-01/examples/VmmServers_Update_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_tests/conftest.py b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/conftest.py new file mode 100644 index 000000000000..e3b4578ea411 --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/conftest.py @@ -0,0 +1,35 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# aovid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + scvmmmgmt_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") + scvmmmgmt_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + scvmmmgmt_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + scvmmmgmt_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=scvmmmgmt_subscription_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=scvmmmgmt_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=scvmmmgmt_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=scvmmmgmt_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/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_availability_sets_operations.py b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_availability_sets_operations.py new file mode 100644 index 000000000000..24d4fa063a99 --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_availability_sets_operations.py @@ -0,0 +1,106 @@ +# 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.scvmm import ScVmmMgmtClient + +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 TestScVmmMgmtAvailabilitySetsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ScVmmMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription(self, resource_group): + response = self.client.availability_sets.list_by_subscription( + api_version="2024-06-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.availability_sets.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-06-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.availability_sets.get( + resource_group_name=resource_group.name, + availability_set_resource_name="str", + api_version="2024-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.availability_sets.begin_create_or_update( + resource_group_name=resource_group.name, + availability_set_resource_name="str", + resource={ + "extendedLocation": {"name": "str", "type": "str"}, + "location": "str", + "id": "str", + "name": "str", + "properties": {"availabilitySetName": "str", "provisioningState": "str", "vmmServerId": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-06-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.availability_sets.begin_update( + resource_group_name=resource_group.name, + availability_set_resource_name="str", + properties={"tags": {"str": "str"}}, + api_version="2024-06-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.availability_sets.begin_delete( + resource_group_name=resource_group.name, + availability_set_resource_name="str", + api_version="2024-06-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_availability_sets_operations_async.py b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_availability_sets_operations_async.py new file mode 100644 index 000000000000..6ebde48dee69 --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_availability_sets_operations_async.py @@ -0,0 +1,113 @@ +# 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.scvmm.aio import ScVmmMgmtClient + +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 TestScVmmMgmtAvailabilitySetsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ScVmmMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription(self, resource_group): + response = self.client.availability_sets.list_by_subscription( + api_version="2024-06-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.availability_sets.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-06-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.availability_sets.get( + resource_group_name=resource_group.name, + availability_set_resource_name="str", + api_version="2024-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.availability_sets.begin_create_or_update( + resource_group_name=resource_group.name, + availability_set_resource_name="str", + resource={ + "extendedLocation": {"name": "str", "type": "str"}, + "location": "str", + "id": "str", + "name": "str", + "properties": {"availabilitySetName": "str", "provisioningState": "str", "vmmServerId": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-06-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.availability_sets.begin_update( + resource_group_name=resource_group.name, + availability_set_resource_name="str", + properties={"tags": {"str": "str"}}, + api_version="2024-06-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.availability_sets.begin_delete( + resource_group_name=resource_group.name, + availability_set_resource_name="str", + api_version="2024-06-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_clouds_operations.py b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_clouds_operations.py new file mode 100644 index 000000000000..5ea2c833e5e1 --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_clouds_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.scvmm import ScVmmMgmtClient + +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 TestScVmmMgmtCloudsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ScVmmMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription(self, resource_group): + response = self.client.clouds.list_by_subscription( + api_version="2024-06-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.clouds.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-06-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.clouds.get( + resource_group_name=resource_group.name, + cloud_resource_name="str", + api_version="2024-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.clouds.begin_create_or_update( + resource_group_name=resource_group.name, + cloud_resource_name="str", + resource={ + "extendedLocation": {"name": "str", "type": "str"}, + "location": "str", + "id": "str", + "name": "str", + "properties": { + "cloudCapacity": {"cpuCount": 0, "memoryMB": 0, "vmCount": 0}, + "cloudName": "str", + "inventoryItemId": "str", + "provisioningState": "str", + "storageQoSPolicies": [ + { + "bandwidthLimit": 0, + "id": "str", + "iopsMaximum": 0, + "iopsMinimum": 0, + "name": "str", + "policyId": "str", + } + ], + "uuid": "str", + "vmmServerId": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-06-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.clouds.begin_update( + resource_group_name=resource_group.name, + cloud_resource_name="str", + properties={"tags": {"str": "str"}}, + api_version="2024-06-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.clouds.begin_delete( + resource_group_name=resource_group.name, + cloud_resource_name="str", + api_version="2024-06-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_clouds_operations_async.py b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_clouds_operations_async.py new file mode 100644 index 000000000000..d9fc1043d45f --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_clouds_operations_async.py @@ -0,0 +1,130 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.scvmm.aio import ScVmmMgmtClient + +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 TestScVmmMgmtCloudsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ScVmmMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription(self, resource_group): + response = self.client.clouds.list_by_subscription( + api_version="2024-06-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.clouds.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-06-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.clouds.get( + resource_group_name=resource_group.name, + cloud_resource_name="str", + api_version="2024-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.clouds.begin_create_or_update( + resource_group_name=resource_group.name, + cloud_resource_name="str", + resource={ + "extendedLocation": {"name": "str", "type": "str"}, + "location": "str", + "id": "str", + "name": "str", + "properties": { + "cloudCapacity": {"cpuCount": 0, "memoryMB": 0, "vmCount": 0}, + "cloudName": "str", + "inventoryItemId": "str", + "provisioningState": "str", + "storageQoSPolicies": [ + { + "bandwidthLimit": 0, + "id": "str", + "iopsMaximum": 0, + "iopsMinimum": 0, + "name": "str", + "policyId": "str", + } + ], + "uuid": "str", + "vmmServerId": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-06-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.clouds.begin_update( + resource_group_name=resource_group.name, + cloud_resource_name="str", + properties={"tags": {"str": "str"}}, + api_version="2024-06-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.clouds.begin_delete( + resource_group_name=resource_group.name, + cloud_resource_name="str", + api_version="2024-06-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_guest_agents_operations.py b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_guest_agents_operations.py new file mode 100644 index 000000000000..f5f45b75adc2 --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_guest_agents_operations.py @@ -0,0 +1,86 @@ +# 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.scvmm import ScVmmMgmtClient + +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 TestScVmmMgmtGuestAgentsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ScVmmMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_virtual_machine_instance(self, resource_group): + response = self.client.guest_agents.list_by_virtual_machine_instance( + resource_uri="str", + api_version="2024-06-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.guest_agents.get( + resource_uri="str", + api_version="2024-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create(self, resource_group): + response = self.client.guest_agents.begin_create( + resource_uri="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "credentials": {"password": "str", "username": "str"}, + "customResourceName": "str", + "httpProxyConfig": {"httpsProxy": "str"}, + "privateLinkScopeResourceId": "str", + "provisioningAction": "str", + "provisioningState": "str", + "status": "str", + "uuid": "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-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.guest_agents.delete( + resource_uri="str", + api_version="2024-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_guest_agents_operations_async.py b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_guest_agents_operations_async.py new file mode 100644 index 000000000000..fd45d62fc202 --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_guest_agents_operations_async.py @@ -0,0 +1,89 @@ +# 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.scvmm.aio import ScVmmMgmtClient + +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 TestScVmmMgmtGuestAgentsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ScVmmMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_virtual_machine_instance(self, resource_group): + response = self.client.guest_agents.list_by_virtual_machine_instance( + resource_uri="str", + api_version="2024-06-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.guest_agents.get( + resource_uri="str", + api_version="2024-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create(self, resource_group): + response = await ( + await self.client.guest_agents.begin_create( + resource_uri="str", + resource={ + "id": "str", + "name": "str", + "properties": { + "credentials": {"password": "str", "username": "str"}, + "customResourceName": "str", + "httpProxyConfig": {"httpsProxy": "str"}, + "privateLinkScopeResourceId": "str", + "provisioningAction": "str", + "provisioningState": "str", + "status": "str", + "uuid": "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-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_delete(self, resource_group): + response = await self.client.guest_agents.delete( + resource_uri="str", + api_version="2024-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_inventory_items_operations.py b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_inventory_items_operations.py new file mode 100644 index 000000000000..2c971418e459 --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_inventory_items_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.scvmm import ScVmmMgmtClient + +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 TestScVmmMgmtInventoryItemsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ScVmmMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_vmm_server(self, resource_group): + response = self.client.inventory_items.list_by_vmm_server( + resource_group_name=resource_group.name, + vmm_server_name="str", + api_version="2024-06-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.inventory_items.get( + resource_group_name=resource_group.name, + vmm_server_name="str", + inventory_item_resource_name="str", + api_version="2024-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create(self, resource_group): + response = self.client.inventory_items.create( + resource_group_name=resource_group.name, + vmm_server_name="str", + inventory_item_resource_name="str", + resource={ + "id": "str", + "kind": "str", + "name": "str", + "properties": "inventory_item_properties", + "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-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_delete(self, resource_group): + response = self.client.inventory_items.delete( + resource_group_name=resource_group.name, + vmm_server_name="str", + inventory_item_resource_name="str", + api_version="2024-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_inventory_items_operations_async.py b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_inventory_items_operations_async.py new file mode 100644 index 000000000000..12da01dc0bf3 --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_inventory_items_operations_async.py @@ -0,0 +1,86 @@ +# 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.scvmm.aio import ScVmmMgmtClient + +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 TestScVmmMgmtInventoryItemsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ScVmmMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_vmm_server(self, resource_group): + response = self.client.inventory_items.list_by_vmm_server( + resource_group_name=resource_group.name, + vmm_server_name="str", + api_version="2024-06-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.inventory_items.get( + resource_group_name=resource_group.name, + vmm_server_name="str", + inventory_item_resource_name="str", + api_version="2024-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create(self, resource_group): + response = await self.client.inventory_items.create( + resource_group_name=resource_group.name, + vmm_server_name="str", + inventory_item_resource_name="str", + resource={ + "id": "str", + "kind": "str", + "name": "str", + "properties": "inventory_item_properties", + "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-01", + ) + + # 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.inventory_items.delete( + resource_group_name=resource_group.name, + vmm_server_name="str", + inventory_item_resource_name="str", + api_version="2024-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_operations.py b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_operations.py new file mode 100644 index 000000000000..558809dd6cfa --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_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.scvmm import ScVmmMgmtClient + +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 TestScVmmMgmtOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ScVmmMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.operations.list( + api_version="2024-06-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_operations_async.py b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_operations_async.py new file mode 100644 index 000000000000..eb565f716495 --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_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.scvmm.aio import ScVmmMgmtClient + +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 TestScVmmMgmtOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ScVmmMgmtClient, 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-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_virtual_machine_instances_operations.py b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_virtual_machine_instances_operations.py new file mode 100644 index 000000000000..bde5605b6086 --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_virtual_machine_instances_operations.py @@ -0,0 +1,283 @@ +# 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.scvmm import ScVmmMgmtClient + +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 TestScVmmMgmtVirtualMachineInstancesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ScVmmMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.virtual_machine_instances.list( + resource_uri="str", + api_version="2024-06-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.virtual_machine_instances.get( + resource_uri="str", + api_version="2024-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.virtual_machine_instances.begin_create_or_update( + resource_uri="str", + resource={ + "extendedLocation": {"name": "str", "type": "str"}, + "id": "str", + "name": "str", + "properties": { + "availabilitySets": [{"id": "str", "name": "str"}], + "hardwareProfile": { + "cpuCount": 0, + "dynamicMemoryEnabled": "str", + "dynamicMemoryMaxMB": 0, + "dynamicMemoryMinMB": 0, + "isHighlyAvailable": "str", + "limitCpuForMigration": "str", + "memoryMB": 0, + }, + "infrastructureProfile": { + "biosGuid": "str", + "checkpointType": "str", + "checkpoints": [ + {"checkpointID": "str", "description": "str", "name": "str", "parentCheckpointID": "str"} + ], + "cloudId": "str", + "generation": 0, + "inventoryItemId": "str", + "lastRestoredVMCheckpoint": { + "checkpointID": "str", + "description": "str", + "name": "str", + "parentCheckpointID": "str", + }, + "templateId": "str", + "uuid": "str", + "vmName": "str", + "vmmServerId": "str", + }, + "networkProfile": { + "networkInterfaces": [ + { + "displayName": "str", + "ipv4AddressType": "str", + "ipv4Addresses": ["str"], + "ipv6AddressType": "str", + "ipv6Addresses": ["str"], + "macAddress": "str", + "macAddressType": "str", + "name": "str", + "networkName": "str", + "nicId": "str", + "virtualNetworkId": "str", + } + ] + }, + "osProfile": { + "adminPassword": "str", + "computerName": "str", + "domainName": "str", + "domainPassword": "str", + "domainUsername": "str", + "osSku": "str", + "osType": "str", + "osVersion": "str", + "productKey": "str", + "runOnceCommands": "str", + "timezone": 0, + "workgroup": "str", + }, + "powerState": "str", + "provisioningState": "str", + "storageProfile": { + "disks": [ + { + "bus": 0, + "busType": "str", + "createDiffDisk": "str", + "diskId": "str", + "diskSizeGB": 0, + "displayName": "str", + "lun": 0, + "maxDiskSizeGB": 0, + "name": "str", + "storageQoSPolicy": {"id": "str", "name": "str"}, + "templateDiskId": "str", + "vhdFormatType": "str", + "vhdType": "str", + "volumeType": "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-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.virtual_machine_instances.begin_update( + resource_uri="str", + properties={ + "properties": { + "availabilitySets": [{"id": "str", "name": "str"}], + "hardwareProfile": { + "cpuCount": 0, + "dynamicMemoryEnabled": "str", + "dynamicMemoryMaxMB": 0, + "dynamicMemoryMinMB": 0, + "limitCpuForMigration": "str", + "memoryMB": 0, + }, + "infrastructureProfile": {"checkpointType": "str"}, + "networkProfile": { + "networkInterfaces": [ + { + "ipv4AddressType": "str", + "ipv6AddressType": "str", + "macAddress": "str", + "macAddressType": "str", + "name": "str", + "nicId": "str", + "virtualNetworkId": "str", + } + ] + }, + "storageProfile": { + "disks": [ + { + "bus": 0, + "busType": "str", + "diskId": "str", + "diskSizeGB": 0, + "lun": 0, + "name": "str", + "storageQoSPolicy": {"id": "str", "name": "str"}, + "vhdType": "str", + } + ] + }, + } + }, + api_version="2024-06-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.virtual_machine_instances.begin_delete( + resource_uri="str", + api_version="2024-06-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_checkpoint(self, resource_group): + response = self.client.virtual_machine_instances.begin_create_checkpoint( + resource_uri="str", + body={"description": "str", "name": "str"}, + api_version="2024-06-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete_checkpoint(self, resource_group): + response = self.client.virtual_machine_instances.begin_delete_checkpoint( + resource_uri="str", + body={"id": "str"}, + api_version="2024-06-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_restart(self, resource_group): + response = self.client.virtual_machine_instances.begin_restart( + resource_uri="str", + api_version="2024-06-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_restore_checkpoint(self, resource_group): + response = self.client.virtual_machine_instances.begin_restore_checkpoint( + resource_uri="str", + body={"id": "str"}, + api_version="2024-06-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_start(self, resource_group): + response = self.client.virtual_machine_instances.begin_start( + resource_uri="str", + api_version="2024-06-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_stop(self, resource_group): + response = self.client.virtual_machine_instances.begin_stop( + resource_uri="str", + api_version="2024-06-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_virtual_machine_instances_operations_async.py b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_virtual_machine_instances_operations_async.py new file mode 100644 index 000000000000..c712b285a1ac --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_virtual_machine_instances_operations_async.py @@ -0,0 +1,307 @@ +# 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.scvmm.aio import ScVmmMgmtClient + +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 TestScVmmMgmtVirtualMachineInstancesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ScVmmMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.virtual_machine_instances.list( + resource_uri="str", + api_version="2024-06-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.virtual_machine_instances.get( + resource_uri="str", + api_version="2024-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.virtual_machine_instances.begin_create_or_update( + resource_uri="str", + resource={ + "extendedLocation": {"name": "str", "type": "str"}, + "id": "str", + "name": "str", + "properties": { + "availabilitySets": [{"id": "str", "name": "str"}], + "hardwareProfile": { + "cpuCount": 0, + "dynamicMemoryEnabled": "str", + "dynamicMemoryMaxMB": 0, + "dynamicMemoryMinMB": 0, + "isHighlyAvailable": "str", + "limitCpuForMigration": "str", + "memoryMB": 0, + }, + "infrastructureProfile": { + "biosGuid": "str", + "checkpointType": "str", + "checkpoints": [ + { + "checkpointID": "str", + "description": "str", + "name": "str", + "parentCheckpointID": "str", + } + ], + "cloudId": "str", + "generation": 0, + "inventoryItemId": "str", + "lastRestoredVMCheckpoint": { + "checkpointID": "str", + "description": "str", + "name": "str", + "parentCheckpointID": "str", + }, + "templateId": "str", + "uuid": "str", + "vmName": "str", + "vmmServerId": "str", + }, + "networkProfile": { + "networkInterfaces": [ + { + "displayName": "str", + "ipv4AddressType": "str", + "ipv4Addresses": ["str"], + "ipv6AddressType": "str", + "ipv6Addresses": ["str"], + "macAddress": "str", + "macAddressType": "str", + "name": "str", + "networkName": "str", + "nicId": "str", + "virtualNetworkId": "str", + } + ] + }, + "osProfile": { + "adminPassword": "str", + "computerName": "str", + "domainName": "str", + "domainPassword": "str", + "domainUsername": "str", + "osSku": "str", + "osType": "str", + "osVersion": "str", + "productKey": "str", + "runOnceCommands": "str", + "timezone": 0, + "workgroup": "str", + }, + "powerState": "str", + "provisioningState": "str", + "storageProfile": { + "disks": [ + { + "bus": 0, + "busType": "str", + "createDiffDisk": "str", + "diskId": "str", + "diskSizeGB": 0, + "displayName": "str", + "lun": 0, + "maxDiskSizeGB": 0, + "name": "str", + "storageQoSPolicy": {"id": "str", "name": "str"}, + "templateDiskId": "str", + "vhdFormatType": "str", + "vhdType": "str", + "volumeType": "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-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.virtual_machine_instances.begin_update( + resource_uri="str", + properties={ + "properties": { + "availabilitySets": [{"id": "str", "name": "str"}], + "hardwareProfile": { + "cpuCount": 0, + "dynamicMemoryEnabled": "str", + "dynamicMemoryMaxMB": 0, + "dynamicMemoryMinMB": 0, + "limitCpuForMigration": "str", + "memoryMB": 0, + }, + "infrastructureProfile": {"checkpointType": "str"}, + "networkProfile": { + "networkInterfaces": [ + { + "ipv4AddressType": "str", + "ipv6AddressType": "str", + "macAddress": "str", + "macAddressType": "str", + "name": "str", + "nicId": "str", + "virtualNetworkId": "str", + } + ] + }, + "storageProfile": { + "disks": [ + { + "bus": 0, + "busType": "str", + "diskId": "str", + "diskSizeGB": 0, + "lun": 0, + "name": "str", + "storageQoSPolicy": {"id": "str", "name": "str"}, + "vhdType": "str", + } + ] + }, + } + }, + api_version="2024-06-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.virtual_machine_instances.begin_delete( + resource_uri="str", + api_version="2024-06-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_checkpoint(self, resource_group): + response = await ( + await self.client.virtual_machine_instances.begin_create_checkpoint( + resource_uri="str", + body={"description": "str", "name": "str"}, + api_version="2024-06-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete_checkpoint(self, resource_group): + response = await ( + await self.client.virtual_machine_instances.begin_delete_checkpoint( + resource_uri="str", + body={"id": "str"}, + api_version="2024-06-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_restart(self, resource_group): + response = await ( + await self.client.virtual_machine_instances.begin_restart( + resource_uri="str", + api_version="2024-06-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_restore_checkpoint(self, resource_group): + response = await ( + await self.client.virtual_machine_instances.begin_restore_checkpoint( + resource_uri="str", + body={"id": "str"}, + api_version="2024-06-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_start(self, resource_group): + response = await ( + await self.client.virtual_machine_instances.begin_start( + resource_uri="str", + api_version="2024-06-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_stop(self, resource_group): + response = await ( + await self.client.virtual_machine_instances.begin_stop( + resource_uri="str", + api_version="2024-06-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_virtual_machine_templates_operations.py b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_virtual_machine_templates_operations.py new file mode 100644 index 000000000000..c26ff50ea5b6 --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_virtual_machine_templates_operations.py @@ -0,0 +1,156 @@ +# 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.scvmm import ScVmmMgmtClient + +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 TestScVmmMgmtVirtualMachineTemplatesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ScVmmMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription(self, resource_group): + response = self.client.virtual_machine_templates.list_by_subscription( + api_version="2024-06-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.virtual_machine_templates.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-06-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.virtual_machine_templates.get( + resource_group_name=resource_group.name, + virtual_machine_template_name="str", + api_version="2024-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.virtual_machine_templates.begin_create_or_update( + resource_group_name=resource_group.name, + virtual_machine_template_name="str", + resource={ + "extendedLocation": {"name": "str", "type": "str"}, + "location": "str", + "id": "str", + "name": "str", + "properties": { + "computerName": "str", + "cpuCount": 0, + "disks": [ + { + "bus": 0, + "busType": "str", + "createDiffDisk": "str", + "diskId": "str", + "diskSizeGB": 0, + "displayName": "str", + "lun": 0, + "maxDiskSizeGB": 0, + "name": "str", + "storageQoSPolicy": {"id": "str", "name": "str"}, + "templateDiskId": "str", + "vhdFormatType": "str", + "vhdType": "str", + "volumeType": "str", + } + ], + "dynamicMemoryEnabled": "str", + "dynamicMemoryMaxMB": 0, + "dynamicMemoryMinMB": 0, + "generation": 0, + "inventoryItemId": "str", + "isCustomizable": "str", + "isHighlyAvailable": "str", + "limitCpuForMigration": "str", + "memoryMB": 0, + "networkInterfaces": [ + { + "displayName": "str", + "ipv4AddressType": "str", + "ipv4Addresses": ["str"], + "ipv6AddressType": "str", + "ipv6Addresses": ["str"], + "macAddress": "str", + "macAddressType": "str", + "name": "str", + "networkName": "str", + "nicId": "str", + "virtualNetworkId": "str", + } + ], + "osName": "str", + "osType": "str", + "provisioningState": "str", + "uuid": "str", + "vmmServerId": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-06-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.virtual_machine_templates.begin_update( + resource_group_name=resource_group.name, + virtual_machine_template_name="str", + properties={"tags": {"str": "str"}}, + api_version="2024-06-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.virtual_machine_templates.begin_delete( + resource_group_name=resource_group.name, + virtual_machine_template_name="str", + api_version="2024-06-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_virtual_machine_templates_operations_async.py b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_virtual_machine_templates_operations_async.py new file mode 100644 index 000000000000..5c3641c50892 --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_virtual_machine_templates_operations_async.py @@ -0,0 +1,163 @@ +# 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.scvmm.aio import ScVmmMgmtClient + +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 TestScVmmMgmtVirtualMachineTemplatesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ScVmmMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription(self, resource_group): + response = self.client.virtual_machine_templates.list_by_subscription( + api_version="2024-06-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.virtual_machine_templates.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-06-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.virtual_machine_templates.get( + resource_group_name=resource_group.name, + virtual_machine_template_name="str", + api_version="2024-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.virtual_machine_templates.begin_create_or_update( + resource_group_name=resource_group.name, + virtual_machine_template_name="str", + resource={ + "extendedLocation": {"name": "str", "type": "str"}, + "location": "str", + "id": "str", + "name": "str", + "properties": { + "computerName": "str", + "cpuCount": 0, + "disks": [ + { + "bus": 0, + "busType": "str", + "createDiffDisk": "str", + "diskId": "str", + "diskSizeGB": 0, + "displayName": "str", + "lun": 0, + "maxDiskSizeGB": 0, + "name": "str", + "storageQoSPolicy": {"id": "str", "name": "str"}, + "templateDiskId": "str", + "vhdFormatType": "str", + "vhdType": "str", + "volumeType": "str", + } + ], + "dynamicMemoryEnabled": "str", + "dynamicMemoryMaxMB": 0, + "dynamicMemoryMinMB": 0, + "generation": 0, + "inventoryItemId": "str", + "isCustomizable": "str", + "isHighlyAvailable": "str", + "limitCpuForMigration": "str", + "memoryMB": 0, + "networkInterfaces": [ + { + "displayName": "str", + "ipv4AddressType": "str", + "ipv4Addresses": ["str"], + "ipv6AddressType": "str", + "ipv6Addresses": ["str"], + "macAddress": "str", + "macAddressType": "str", + "name": "str", + "networkName": "str", + "nicId": "str", + "virtualNetworkId": "str", + } + ], + "osName": "str", + "osType": "str", + "provisioningState": "str", + "uuid": "str", + "vmmServerId": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-06-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.virtual_machine_templates.begin_update( + resource_group_name=resource_group.name, + virtual_machine_template_name="str", + properties={"tags": {"str": "str"}}, + api_version="2024-06-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.virtual_machine_templates.begin_delete( + resource_group_name=resource_group.name, + virtual_machine_template_name="str", + api_version="2024-06-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_virtual_networks_operations.py b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_virtual_networks_operations.py new file mode 100644 index 000000000000..f30f43b3f7d1 --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_virtual_networks_operations.py @@ -0,0 +1,112 @@ +# 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.scvmm import ScVmmMgmtClient + +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 TestScVmmMgmtVirtualNetworksOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ScVmmMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription(self, resource_group): + response = self.client.virtual_networks.list_by_subscription( + api_version="2024-06-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.virtual_networks.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-06-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.virtual_networks.get( + resource_group_name=resource_group.name, + virtual_network_name="str", + api_version="2024-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.virtual_networks.begin_create_or_update( + resource_group_name=resource_group.name, + virtual_network_name="str", + resource={ + "extendedLocation": {"name": "str", "type": "str"}, + "location": "str", + "id": "str", + "name": "str", + "properties": { + "inventoryItemId": "str", + "networkName": "str", + "provisioningState": "str", + "uuid": "str", + "vmmServerId": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-06-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.virtual_networks.begin_update( + resource_group_name=resource_group.name, + virtual_network_name="str", + properties={"tags": {"str": "str"}}, + api_version="2024-06-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.virtual_networks.begin_delete( + resource_group_name=resource_group.name, + virtual_network_name="str", + api_version="2024-06-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_virtual_networks_operations_async.py b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_virtual_networks_operations_async.py new file mode 100644 index 000000000000..9be3107e2b6e --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_virtual_networks_operations_async.py @@ -0,0 +1,119 @@ +# 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.scvmm.aio import ScVmmMgmtClient + +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 TestScVmmMgmtVirtualNetworksOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ScVmmMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription(self, resource_group): + response = self.client.virtual_networks.list_by_subscription( + api_version="2024-06-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.virtual_networks.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-06-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.virtual_networks.get( + resource_group_name=resource_group.name, + virtual_network_name="str", + api_version="2024-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.virtual_networks.begin_create_or_update( + resource_group_name=resource_group.name, + virtual_network_name="str", + resource={ + "extendedLocation": {"name": "str", "type": "str"}, + "location": "str", + "id": "str", + "name": "str", + "properties": { + "inventoryItemId": "str", + "networkName": "str", + "provisioningState": "str", + "uuid": "str", + "vmmServerId": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-06-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.virtual_networks.begin_update( + resource_group_name=resource_group.name, + virtual_network_name="str", + properties={"tags": {"str": "str"}}, + api_version="2024-06-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.virtual_networks.begin_delete( + resource_group_name=resource_group.name, + virtual_network_name="str", + api_version="2024-06-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_vm_instance_hybrid_identity_metadatas_operations.py b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_vm_instance_hybrid_identity_metadatas_operations.py new file mode 100644 index 000000000000..8653da204cec --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_vm_instance_hybrid_identity_metadatas_operations.py @@ -0,0 +1,41 @@ +# 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.scvmm import ScVmmMgmtClient + +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 TestScVmmMgmtVmInstanceHybridIdentityMetadatasOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ScVmmMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_virtual_machine_instance(self, resource_group): + response = self.client.vm_instance_hybrid_identity_metadatas.list_by_virtual_machine_instance( + resource_uri="str", + api_version="2024-06-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.vm_instance_hybrid_identity_metadatas.get( + resource_uri="str", + api_version="2024-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_vm_instance_hybrid_identity_metadatas_operations_async.py b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_vm_instance_hybrid_identity_metadatas_operations_async.py new file mode 100644 index 000000000000..9a29e8c69a08 --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_vm_instance_hybrid_identity_metadatas_operations_async.py @@ -0,0 +1,42 @@ +# 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.scvmm.aio import ScVmmMgmtClient + +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 TestScVmmMgmtVmInstanceHybridIdentityMetadatasOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ScVmmMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_virtual_machine_instance(self, resource_group): + response = self.client.vm_instance_hybrid_identity_metadatas.list_by_virtual_machine_instance( + resource_uri="str", + api_version="2024-06-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.vm_instance_hybrid_identity_metadatas.get( + resource_uri="str", + api_version="2024-06-01", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_vmm_servers_operations.py b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_vmm_servers_operations.py new file mode 100644 index 000000000000..dd1cdaa1f39a --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_vmm_servers_operations.py @@ -0,0 +1,115 @@ +# 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.scvmm import ScVmmMgmtClient + +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 TestScVmmMgmtVmmServersOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ScVmmMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription(self, resource_group): + response = self.client.vmm_servers.list_by_subscription( + api_version="2024-06-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.vmm_servers.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-06-01", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.vmm_servers.get( + resource_group_name=resource_group.name, + vmm_server_name="str", + api_version="2024-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.vmm_servers.begin_create_or_update( + resource_group_name=resource_group.name, + vmm_server_name="str", + resource={ + "extendedLocation": {"name": "str", "type": "str"}, + "location": "str", + "id": "str", + "name": "str", + "properties": { + "fqdn": "str", + "connectionStatus": "str", + "credentials": {"password": "str", "username": "str"}, + "errorMessage": "str", + "port": 0, + "provisioningState": "str", + "uuid": "str", + "version": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-06-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.vmm_servers.begin_update( + resource_group_name=resource_group.name, + vmm_server_name="str", + properties={"tags": {"str": "str"}}, + api_version="2024-06-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.vmm_servers.begin_delete( + resource_group_name=resource_group.name, + vmm_server_name="str", + api_version="2024-06-01", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_vmm_servers_operations_async.py b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_vmm_servers_operations_async.py new file mode 100644 index 000000000000..838a3e88c335 --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_vmm_servers_operations_async.py @@ -0,0 +1,122 @@ +# 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.scvmm.aio import ScVmmMgmtClient + +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 TestScVmmMgmtVmmServersOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(ScVmmMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription(self, resource_group): + response = self.client.vmm_servers.list_by_subscription( + api_version="2024-06-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.vmm_servers.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-06-01", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.vmm_servers.get( + resource_group_name=resource_group.name, + vmm_server_name="str", + api_version="2024-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.vmm_servers.begin_create_or_update( + resource_group_name=resource_group.name, + vmm_server_name="str", + resource={ + "extendedLocation": {"name": "str", "type": "str"}, + "location": "str", + "id": "str", + "name": "str", + "properties": { + "fqdn": "str", + "connectionStatus": "str", + "credentials": {"password": "str", "username": "str"}, + "errorMessage": "str", + "port": 0, + "provisioningState": "str", + "uuid": "str", + "version": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + api_version="2024-06-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.vmm_servers.begin_update( + resource_group_name=resource_group.name, + vmm_server_name="str", + properties={"tags": {"str": "str"}}, + api_version="2024-06-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.vmm_servers.begin_delete( + resource_group_name=resource_group.name, + vmm_server_name="str", + api_version="2024-06-01", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/scvmm/azure-mgmt-scvmm/setup.py b/sdk/scvmm/azure-mgmt-scvmm/setup.py index 9c259fcef964..ff1cc1a1d37e 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/setup.py +++ b/sdk/scvmm/azure-mgmt-scvmm/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", ],