From 41baeb5720a23ea0cf87983bd3f54b4c300b6f01 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Sun, 27 Apr 2025 04:17:09 +0000 Subject: [PATCH] CodeGen from PR 34242 in Azure/azure-rest-api-specs Merge 8fbc11097a7044c1adc129e989a96f3988cf536d into 11059b2f00c7572b276dc9862c0b41db8702cc78 --- sdk/scvmm/azure-mgmt-scvmm/CHANGELOG.md | 18 + sdk/scvmm/azure-mgmt-scvmm/README.md | 6 +- sdk/scvmm/azure-mgmt-scvmm/_meta.json | 6 +- .../azure/mgmt/scvmm/__init__.py | 12 +- .../azure/mgmt/scvmm/_configuration.py | 7 +- .../azure/mgmt/scvmm/_sc_vmm_mgmt_client.py | 34 +- .../scvmm/{_vendor.py => _utils/__init__.py} | 10 - .../serialization.py} | 568 ++++++++++-------- .../azure/mgmt/scvmm/_version.py | 2 +- .../azure/mgmt/scvmm/aio/__init__.py | 12 +- .../azure/mgmt/scvmm/aio/_configuration.py | 7 +- .../mgmt/scvmm/aio/_sc_vmm_mgmt_client.py | 36 +- .../mgmt/scvmm/aio/operations/__init__.py | 31 +- .../_availability_sets_operations.py | 109 ++-- .../aio/operations/_clouds_operations.py | 109 ++-- .../operations/_guest_agents_operations.py | 62 +- .../operations/_inventory_items_operations.py | 47 +- .../mgmt/scvmm/aio/operations/_operations.py | 28 +- .../_virtual_machine_instances_operations.py | 286 +++++---- .../_virtual_machine_templates_operations.py | 109 ++-- .../_virtual_networks_operations.py | 109 ++-- ...ce_hybrid_identity_metadatas_operations.py | 33 +- .../aio/operations/_vmm_servers_operations.py | 109 ++-- .../azure/mgmt/scvmm/models/__init__.py | 197 +++--- .../azure/mgmt/scvmm/models/_models_py3.py | 316 ++++++---- .../azure/mgmt/scvmm/operations/__init__.py | 31 +- .../_availability_sets_operations.py | 133 ++-- .../scvmm/operations/_clouds_operations.py | 133 ++-- .../operations/_guest_agents_operations.py | 75 ++- .../operations/_inventory_items_operations.py | 63 +- .../mgmt/scvmm/operations/_operations.py | 31 +- .../_virtual_machine_instances_operations.py | 315 ++++++---- .../_virtual_machine_templates_operations.py | 133 ++-- .../_virtual_networks_operations.py | 133 ++-- ...ce_hybrid_identity_metadatas_operations.py | 42 +- .../operations/_vmm_servers_operations.py | 133 ++-- ...y_sets_create_or_update_maximum_set_gen.py | 5 +- ...y_sets_create_or_update_minimum_set_gen.py | 5 +- ...vailability_sets_delete_maximum_set_gen.py | 3 +- ...vailability_sets_delete_minimum_set_gen.py | 3 +- .../availability_sets_get_maximum_set_gen.py | 3 +- .../availability_sets_get_minimum_set_gen.py | 3 +- ..._list_by_resource_group_maximum_set_gen.py | 3 +- ..._list_by_resource_group_minimum_set_gen.py | 3 +- ...ts_list_by_subscription_maximum_set_gen.py | 3 +- ...ts_list_by_subscription_minimum_set_gen.py | 3 +- ...vailability_sets_update_maximum_set_gen.py | 5 +- ...clouds_create_or_update_maximum_set_gen.py | 5 +- ...clouds_create_or_update_minimum_set_gen.py | 5 +- .../clouds_delete_maximum_set_gen.py | 3 +- .../clouds_delete_minimum_set_gen.py | 3 +- .../clouds_get_maximum_set_gen.py | 3 +- .../clouds_get_minimum_set_gen.py | 3 +- ..._list_by_resource_group_maximum_set_gen.py | 3 +- ..._list_by_resource_group_minimum_set_gen.py | 3 +- ...ds_list_by_subscription_maximum_set_gen.py | 3 +- ...ds_list_by_subscription_minimum_set_gen.py | 3 +- .../clouds_update_maximum_set_gen.py | 5 +- .../guest_agents_create_maximum_set_gen.py | 5 +- .../guest_agents_delete_maximum_set_gen.py | 3 +- .../guest_agents_delete_minimum_set_gen.py | 3 +- .../guest_agents_get_maximum_set_gen.py | 3 +- .../guest_agents_get_minimum_set_gen.py | 3 +- ...irtual_machine_instance_maximum_set_gen.py | 3 +- ...irtual_machine_instance_minimum_set_gen.py | 3 +- .../inventory_items_create_maximum_set_gen.py | 5 +- .../inventory_items_delete_maximum_set_gen.py | 3 +- .../inventory_items_delete_minimum_set_gen.py | 3 +- .../inventory_items_get_maximum_set_gen.py | 3 +- .../inventory_items_get_minimum_set_gen.py | 3 +- ...tems_list_by_vmm_server_maximum_set_gen.py | 3 +- ...tems_list_by_vmm_server_minimum_set_gen.py | 3 +- .../operations_list_maximum_set_gen.py | 3 +- .../operations_list_minimum_set_gen.py | 3 +- ...ances_create_checkpoint_maximum_set_gen.py | 5 +- ...tances_create_or_update_maximum_set_gen.py | 13 +- ...tances_create_or_update_minimum_set_gen.py | 5 +- ...ances_delete_checkpoint_maximum_set_gen.py | 5 +- ...achine_instances_delete_maximum_set_gen.py | 3 +- ...achine_instances_delete_minimum_set_gen.py | 3 +- ...l_machine_instances_get_maximum_set_gen.py | 3 +- ...l_machine_instances_get_minimum_set_gen.py | 3 +- ..._machine_instances_list_maximum_set_gen.py | 3 +- ..._machine_instances_list_minimum_set_gen.py | 3 +- ...chine_instances_restart_maximum_set_gen.py | 3 +- ...chine_instances_restart_minimum_set_gen.py | 3 +- ...nces_restore_checkpoint_maximum_set_gen.py | 5 +- ...machine_instances_start_maximum_set_gen.py | 3 +- ...machine_instances_start_minimum_set_gen.py | 3 +- ..._machine_instances_stop_maximum_set_gen.py | 6 +- ..._machine_instances_stop_minimum_set_gen.py | 41 ++ ...achine_instances_update_maximum_set_gen.py | 5 +- ...plates_create_or_update_maximum_set_gen.py | 5 +- ...plates_create_or_update_minimum_set_gen.py | 5 +- ...achine_templates_delete_maximum_set_gen.py | 3 +- ...achine_templates_delete_minimum_set_gen.py | 3 +- ...l_machine_templates_get_maximum_set_gen.py | 3 +- ...l_machine_templates_get_minimum_set_gen.py | 3 +- ..._list_by_resource_group_maximum_set_gen.py | 3 +- ..._list_by_resource_group_minimum_set_gen.py | 3 +- ...es_list_by_subscription_maximum_set_gen.py | 3 +- ...es_list_by_subscription_minimum_set_gen.py | 3 +- ...achine_templates_update_maximum_set_gen.py | 5 +- ...tworks_create_or_update_maximum_set_gen.py | 5 +- ...tworks_create_or_update_minimum_set_gen.py | 5 +- ...virtual_networks_delete_maximum_set_gen.py | 3 +- ...virtual_networks_delete_minimum_set_gen.py | 3 +- .../virtual_networks_get_maximum_set_gen.py | 3 +- .../virtual_networks_get_minimum_set_gen.py | 3 +- ..._list_by_resource_group_maximum_set_gen.py | 3 +- ..._list_by_resource_group_minimum_set_gen.py | 3 +- ...ks_list_by_subscription_maximum_set_gen.py | 3 +- ...ks_list_by_subscription_minimum_set_gen.py | 3 +- ...virtual_networks_update_maximum_set_gen.py | 5 +- ..._identity_metadatas_get_maximum_set_gen.py | 3 +- ..._identity_metadatas_get_minimum_set_gen.py | 3 +- ...irtual_machine_instance_maximum_set_gen.py | 3 +- ...irtual_machine_instance_minimum_set_gen.py | 3 +- ...ervers_create_or_update_maximum_set_gen.py | 5 +- ...ervers_create_or_update_minimum_set_gen.py | 5 +- .../vmm_servers_delete_maximum_set_gen.py | 3 +- .../vmm_servers_delete_minimum_set_gen.py | 3 +- .../vmm_servers_get_maximum_set_gen.py | 3 +- .../vmm_servers_get_minimum_set_gen.py | 3 +- ..._list_by_resource_group_maximum_set_gen.py | 3 +- ..._list_by_resource_group_minimum_set_gen.py | 3 +- ...rs_list_by_subscription_maximum_set_gen.py | 3 +- ...rs_list_by_subscription_minimum_set_gen.py | 3 +- .../vmm_servers_update_maximum_set_gen.py | 5 +- .../generated_tests/conftest.py | 35 ++ ...c_vmm_mgmt_availability_sets_operations.py | 106 ++++ ...mgmt_availability_sets_operations_async.py | 113 ++++ .../test_sc_vmm_mgmt_clouds_operations.py | 123 ++++ ...est_sc_vmm_mgmt_clouds_operations_async.py | 130 ++++ ...est_sc_vmm_mgmt_guest_agents_operations.py | 86 +++ ..._vmm_mgmt_guest_agents_operations_async.py | 89 +++ ..._sc_vmm_mgmt_inventory_items_operations.py | 85 +++ ...m_mgmt_inventory_items_operations_async.py | 86 +++ .../test_sc_vmm_mgmt_operations.py | 29 + .../test_sc_vmm_mgmt_operations_async.py | 30 + ...mt_virtual_machine_instances_operations.py | 284 +++++++++ ...tual_machine_instances_operations_async.py | 308 ++++++++++ ...mt_virtual_machine_templates_operations.py | 156 +++++ ...tual_machine_templates_operations_async.py | 163 +++++ ...sc_vmm_mgmt_virtual_networks_operations.py | 112 ++++ ..._mgmt_virtual_networks_operations_async.py | 119 ++++ ...ce_hybrid_identity_metadatas_operations.py | 41 ++ ...rid_identity_metadatas_operations_async.py | 42 ++ ...test_sc_vmm_mgmt_vmm_servers_operations.py | 115 ++++ ...c_vmm_mgmt_vmm_servers_operations_async.py | 122 ++++ sdk/scvmm/azure-mgmt-scvmm/setup.py | 6 +- 151 files changed, 4515 insertions(+), 1724 deletions(-) rename sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/{_vendor.py => _utils/__init__.py} (58%) rename sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/{_serialization.py => _utils/serialization.py} (83%) create mode 100644 sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_stop_minimum_set_gen.py create mode 100644 sdk/scvmm/azure-mgmt-scvmm/generated_tests/conftest.py create mode 100644 sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_availability_sets_operations.py create mode 100644 sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_availability_sets_operations_async.py create mode 100644 sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_clouds_operations.py create mode 100644 sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_clouds_operations_async.py create mode 100644 sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_guest_agents_operations.py create mode 100644 sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_guest_agents_operations_async.py create mode 100644 sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_inventory_items_operations.py create mode 100644 sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_inventory_items_operations_async.py create mode 100644 sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_operations.py create mode 100644 sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_operations_async.py create mode 100644 sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_virtual_machine_instances_operations.py create mode 100644 sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_virtual_machine_instances_operations_async.py create mode 100644 sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_virtual_machine_templates_operations.py create mode 100644 sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_virtual_machine_templates_operations_async.py create mode 100644 sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_virtual_networks_operations.py create mode 100644 sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_virtual_networks_operations_async.py create mode 100644 sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_vm_instance_hybrid_identity_metadatas_operations.py create mode 100644 sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_vm_instance_hybrid_identity_metadatas_operations_async.py create mode 100644 sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_vmm_servers_operations.py create mode 100644 sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_vmm_servers_operations_async.py diff --git a/sdk/scvmm/azure-mgmt-scvmm/CHANGELOG.md b/sdk/scvmm/azure-mgmt-scvmm/CHANGELOG.md index b9b30a51c1e7..c71a96df3180 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/CHANGELOG.md +++ b/sdk/scvmm/azure-mgmt-scvmm/CHANGELOG.md @@ -1,5 +1,23 @@ # Release History +## 1.1.0 (2025-04-27) + +### Features Added + + - Model `CloudCapacity` added property `storage_gb` + - Model `GuestAgentProperties` added property `private_link_scope_resource_id` + - Model `OsProfileForVmInstance` added property `admin_username` + - Model `OsProfileForVmInstance` added property `domain_name` + - Model `OsProfileForVmInstance` added property `domain_username` + - Model `OsProfileForVmInstance` added property `domain_password` + - Model `OsProfileForVmInstance` added property `workgroup` + - Model `OsProfileForVmInstance` added property `product_key` + - Model `OsProfileForVmInstance` added property `timezone` + - Model `OsProfileForVmInstance` added property `run_once_commands` + - Model `VirtualMachineInventoryItem` added property `generation` + - Method `VirtualMachineInstancesOperations.begin_stop` has a new overload `def begin_stop(self: None, resource_uri: str, body: Optional[StopVirtualMachineOptions], content_type: str)` + - Method `VirtualMachineInstancesOperations.begin_stop` has a new overload `def begin_stop(self: None, resource_uri: str, body: Optional[IO[bytes]], content_type: str)` + ## 1.0.0 (2024-06-20) ### Features Added diff --git a/sdk/scvmm/azure-mgmt-scvmm/README.md b/sdk/scvmm/azure-mgmt-scvmm/README.md index 2bf3587d17fc..880d19eaf171 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/README.md +++ b/sdk/scvmm/azure-mgmt-scvmm/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Scvmm Management Client Library. -This package has been tested with Python 3.8+. +This package has been tested with Python 3.9+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.8+ is required to use this package. +- Python 3.9+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package @@ -24,7 +24,7 @@ pip install azure-identity ### Authentication -By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configuration of the following environment variables. - `AZURE_CLIENT_ID` for Azure client ID. - `AZURE_TENANT_ID` for Azure tenant ID. diff --git a/sdk/scvmm/azure-mgmt-scvmm/_meta.json b/sdk/scvmm/azure-mgmt-scvmm/_meta.json index 15a49f7772e3..0bee0838a793 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/_meta.json +++ b/sdk/scvmm/azure-mgmt-scvmm/_meta.json @@ -1,11 +1,11 @@ { - "commit": "061505b89d5d0bbcc9f980e2276f79ff354ce286", + "commit": "c908490d3d2b6fdd1a5dfa108a0f47183e4c06e0", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.10.2", "use": [ - "@autorest/python@6.13.19", + "@autorest/python@6.34.1", "@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.34.1 --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/__init__.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/__init__.py index 278d7e200658..54ff7f1b3106 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/__init__.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._sc_vmm_mgmt_client import ScVmmMgmtClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._sc_vmm_mgmt_client import ScVmmMgmtClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "ScVmmMgmtClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() 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..93711cc390d8 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_configuration.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_configuration.py @@ -14,11 +14,10 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ScVmmMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class ScVmmMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for ScVmmMgmtClient. Note that all parameters used to create this instance are saved as instance @@ -28,13 +27,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 "2025-03-13". 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", "2025-03-13") 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..9fdcdce3a9e6 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 @@ -7,16 +7,19 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from ._configuration import ScVmmMgmtClientConfiguration -from ._serialization import Deserializer, Serializer +from ._utils.serialization import Deserializer, Serializer from .operations import ( AvailabilitySetsOperations, CloudsOperations, @@ -31,11 +34,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ScVmmMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class ScVmmMgmtClient: # pylint: disable=too-many-instance-attributes """The Microsoft.ScVmm Rest API spec. :ivar virtual_machine_instances: VirtualMachineInstancesOperations operations @@ -66,9 +68,9 @@ class ScVmmMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too :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 - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :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 "2025-03-13". 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 @@ -76,13 +78,17 @@ class ScVmmMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = ScVmmMgmtClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ScVmmMgmtClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -101,7 +107,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -153,7 +159,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/_vendor.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_utils/__init__.py similarity index 58% rename from sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_vendor.py rename to sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_utils/__init__.py index 0dafe0e287ff..0af9b28f6607 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_vendor.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_utils/__init__.py @@ -4,13 +4,3 @@ # 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/_serialization.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_utils/serialization.py similarity index 83% rename from sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_serialization.py rename to sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_utils/serialization.py index f0c6180722c8..f5187701d7be 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_serialization.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/_utils/serialization.py @@ -1,30 +1,12 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- -# # Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# +# 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. # -------------------------------------------------------------------------- -# pylint: skip-file # pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode @@ -48,11 +30,8 @@ IO, Mapping, Callable, - TypeVar, MutableMapping, - Type, List, - Mapping, ) try: @@ -62,13 +41,13 @@ import xml.etree.ElementTree as ET import isodate # type: ignore +from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -ModelType = TypeVar("ModelType", bound="Model") JSON = MutableMapping[str, Any] @@ -91,6 +70,8 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: :param data: Input, could be bytes or stream (will be decoded with UTF8) or text :type data: str or bytes or IO :param str content_type: The content type. + :return: The deserialized data. + :rtype: object """ if hasattr(data, "read"): # Assume a stream @@ -112,7 +93,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: try: return json.loads(data_as_str) except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) + raise DeserializationError("JSON is invalid: {}".format(err), err) from err elif "xml" in (content_type or []): try: @@ -144,6 +125,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 @@ -153,6 +136,11 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], Use bytes and headers to NOT use any requests/aiohttp or whatever specific implementation. Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object """ # Try to use content-type from headers if available content_type = None @@ -177,80 +165,31 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], except NameError: _long_type = int - -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0.""" - return datetime.timedelta(0) - - def tzname(self, dt): - """Timestamp representation.""" - return "Z" - - def dst(self, dt): - """No daylight saving for UTC.""" - return datetime.timedelta(hours=1) - - -try: - from datetime import timezone as _FixedOffset # type: ignore -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset): - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc -except ImportError: - TZ_UTC = UTC() # type: ignore +TZ_UTC = datetime.timezone.utc _FLATTEN = re.compile(r"(? None: self.additional_properties: Optional[Dict[str, Any]] = {} - for k in kwargs: + for k in kwargs: # pylint: disable=consider-using-dict-items if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) elif k in self._validation and self._validation[k].get("readonly", False): @@ -298,13 +244,23 @@ def __init__(self, **kwargs: Any) -> None: setattr(self, k, kwargs[k]) def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ return not self.__eq__(other) def __str__(self) -> str: @@ -324,7 +280,11 @@ def is_xml_model(cls) -> bool: @classmethod def _create_xml_node(cls): - """Create XML node.""" + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ try: xml_map = cls._xml_map # type: ignore except AttributeError: @@ -344,7 +304,9 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) def as_dict( self, @@ -378,12 +340,15 @@ def my_key_transformer(key, attr_desc, value): If you want XML serialization, you can pass the kwargs is_xml=True. + :param bool keep_readonly: If you want to serialize the readonly attributes :param function key_transformer: A key transformer function. :returns: A dict JSON compatible object :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) @classmethod def _infer_class_models(cls): @@ -393,30 +358,31 @@ def _infer_class_models(cls): client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} if cls.__name__ not in client_models: raise ValueError("Not Autorest generated code") - except Exception: + except Exception: # pylint: disable=broad-exception-caught # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. client_models = {cls.__name__: cls} return client_models @classmethod - def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( - cls: Type[ModelType], + cls, data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, - ) -> ModelType: + ) -> Self: """Parse a dict using given key extractor return a model. By default consider key @@ -424,9 +390,11 @@ def from_dict( and last_rest_key_case_insensitive_extractor) :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -446,21 +414,25 @@ def _flatten_subtype(cls, key, objects): return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): - result.update(objects[valuetype]._flatten_subtype(key, objects)) + result.update(objects[valuetype]._flatten_subtype(key, objects)) # pylint: disable=protected-access return result @classmethod def _classify(cls, response, objects): """Check the class _subtype_map for any child classes. We want to ignore any inherited _subtype_maps. - Remove the polymorphic key from the initial data. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class """ for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): subtype_value = None if not isinstance(response, ET.Element): rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) else: subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) if subtype_value: @@ -499,11 +471,13 @@ def _decode_attribute_map_key(key): inside the received data. :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str """ return key.replace("\\.", ".") -class Serializer(object): +class Serializer: # pylint: disable=too-many-public-methods """Request object model serializer.""" basic_types = {str: "str", int: "int", bool: "bool", float: "float"} @@ -538,7 +512,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -558,13 +532,16 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None): self.key_transformer = full_restapi_key_transformer self.client_side_validation = True - def _serialize(self, target_obj, data_type=None, **kwargs): + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): """Serialize data into a string according to type. - :param target_obj: The data to be serialized. + :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict - :raises: SerializationError if serialization fails. + :raises SerializationError: if serialization fails. + :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) keep_readonly = kwargs.get("keep_readonly", False) @@ -590,12 +567,14 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized = {} if is_xml_model_serialization: - serialized = target_obj._create_xml_node() + serialized = target_obj._create_xml_node() # pylint: disable=protected-access try: - attributes = target_obj._attribute_map + attributes = target_obj._attribute_map # pylint: disable=protected-access for attr, attr_desc in attributes.items(): attr_name = attr - if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): continue if attr_name == "additional_properties" and attr_desc["key"] == "": @@ -631,7 +610,8 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if isinstance(new_attr, list): serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + # If the down XML has no XML/Name, + # we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): splitted_tag = new_attr.tag.split("}") if len(splitted_tag) == 2: # Namespace @@ -662,17 +642,17 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) raise SerializationError(msg) from err - else: - return serialized + return serialized def body(self, data, data_type, **kwargs): """Serialize data intended for a request body. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict - :raises: SerializationError if serialization fails. - :raises: ValueError if data is None + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized request body """ # Just in case this is a dict @@ -701,7 +681,7 @@ def body(self, data, data_type, **kwargs): attribute_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, ] - data = deserializer._deserialize(data_type, data) + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access except DeserializationError as err: raise SerializationError("Unable to build a model: " + str(err)) from err @@ -710,11 +690,13 @@ def body(self, data, data_type, **kwargs): def url(self, name, data, data_type, **kwargs): """Serialize data intended for a URL path. - :param data: The data to be serialized. + :param str name: The name of the URL path parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :returns: The serialized URL path + :raises TypeError: if serialization fails. + :raises ValueError: if data is None """ try: output = self.serialize_data(data, data_type, **kwargs) @@ -726,21 +708,20 @@ def url(self, name, data, data_type, **kwargs): output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return output + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return output def query(self, name, data, data_type, **kwargs): """Serialize data intended for a URL query. - :param data: The data to be serialized. + :param str name: The name of the query parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :keyword bool skip_quote: Whether to skip quote the serialized result. - Defaults to False. :rtype: str, list - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized query parameter """ try: # Treat the list aside, since we don't want to encode the div separator @@ -757,19 +738,20 @@ def query(self, name, data, data_type, **kwargs): output = str(output) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def header(self, name, data, data_type, **kwargs): """Serialize data intended for a request header. - :param data: The data to be serialized. + :param str name: The name of the header. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized header """ try: if data_type in ["[str]"]: @@ -778,21 +760,20 @@ def header(self, name, data, data_type, **kwargs): output = self.serialize_data(data, data_type, **kwargs) if data_type == "bool": output = json.dumps(output) - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def serialize_data(self, data, data_type, **kwargs): """Serialize generic data according to supplied data type. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :param bool required: Whether it's essential that the data not be - empty or None - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list """ if data is None: raise ValueError("No value for given attribute") @@ -803,7 +784,7 @@ def serialize_data(self, data, data_type, **kwargs): if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) - elif data_type in self.serialize_type: + if data_type in self.serialize_type: return self.serialize_type[data_type](data, **kwargs) # If dependencies is empty, try with current data class @@ -819,11 +800,10 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." raise SerializationError(msg.format(data, data_type)) from err - else: - return self._serialize(data, **kwargs) + return self._serialize(data, **kwargs) @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) if custom_serializer: return custom_serializer @@ -839,23 +819,26 @@ def serialize_basic(cls, data, data_type, **kwargs): - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - is_xml bool : If set, use xml_basic_types_serializers - :param data: Object to be serialized. + :param obj data: Object to be serialized. :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object """ custom_serializer = cls._get_custom_serializers(data_type, **kwargs) if custom_serializer: return custom_serializer(data) if data_type == "str": return cls.serialize_unicode(data) - return eval(data_type)(data) # nosec + return eval(data_type)(data) # nosec # pylint: disable=eval-used @classmethod def serialize_unicode(cls, data): """Special handling for serializing unicode strings in Py2. Encode to UTF-8 if unicode, otherwise handle as a str. - :param data: Object to be serialized. + :param str data: Object to be serialized. :rtype: str + :return: serialized object """ try: # If I received an enum, return its value return data.value @@ -869,8 +852,7 @@ def serialize_unicode(cls, data): return data except NameError: return str(data) - else: - return str(data) + return str(data) def serialize_iter(self, data, iter_type, div=None, **kwargs): """Serialize iterable. @@ -880,15 +862,13 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): serialization_ctxt['type'] should be same as data_type. - is_xml bool : If set, serialize as XML - :param list attr: Object to be serialized. + :param list data: Object to be serialized. :param str iter_type: Type of object in the iterable. - :param bool required: Whether the objects in the iterable must - not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. - :keyword bool do_quote: Whether to quote the serialized result of each iterable element. Defaults to False. :rtype: list, str + :return: serialized iterable """ if isinstance(data, str): raise SerializationError("Refuse str type as a valid iter type.") @@ -943,9 +923,8 @@ def serialize_dict(self, attr, dict_type, **kwargs): :param dict attr: Object to be serialized. :param str dict_type: Type of object in the dictionary. - :param bool required: Whether the objects in the dictionary must - not be None or empty. :rtype: dict + :return: serialized dictionary """ serialization_ctxt = kwargs.get("serialization_ctxt", {}) serialized = {} @@ -969,7 +948,7 @@ def serialize_dict(self, attr, dict_type, **kwargs): return serialized - def serialize_object(self, attr, **kwargs): + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Serialize a generic object. This will be handled as a dictionary. If object passed in is not a basic type (str, int, float, dict, list) it will simply be @@ -977,6 +956,7 @@ def serialize_object(self, attr, **kwargs): :param dict attr: Object to be serialized. :rtype: dict or str + :return: serialized object """ if attr is None: return None @@ -1001,7 +981,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_decimal(attr) # If it's a model or I know this dependency, serialize as a Model - elif obj_type in self.dependencies.values() or isinstance(attr, Model): + if obj_type in self.dependencies.values() or isinstance(attr, Model): return self._serialize(attr) if obj_type == dict: @@ -1032,56 +1012,61 @@ def serialize_enum(attr, enum_obj=None): try: enum_obj(result) # type: ignore return result - except ValueError: + except ValueError as exc: for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) + raise SerializationError(error.format(attr, enum_obj)) from exc @staticmethod - def serialize_bytearray(attr, **kwargs): + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument """Serialize bytearray into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ return b64encode(attr).decode() @staticmethod - def serialize_base64(attr, **kwargs): + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument """Serialize str into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ encoded = b64encode(attr).decode("ascii") return encoded.strip("=").replace("+", "-").replace("/", "_") @staticmethod - def serialize_decimal(attr, **kwargs): + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument """Serialize Decimal object to float. - :param attr: Object to be serialized. + :param decimal attr: Object to be serialized. :rtype: float + :return: serialized decimal """ return float(attr) @staticmethod - def serialize_long(attr, **kwargs): + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument """Serialize long (Py2) or int (Py3). - :param attr: Object to be serialized. + :param int attr: Object to be serialized. :rtype: int/long + :return: serialized long """ return _long_type(attr) @staticmethod - def serialize_date(attr, **kwargs): + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument """Serialize Date object into ISO-8601 formatted string. :param Date attr: Object to be serialized. :rtype: str + :return: serialized date """ if isinstance(attr, str): attr = isodate.parse_date(attr) @@ -1089,11 +1074,12 @@ def serialize_date(attr, **kwargs): return t @staticmethod - def serialize_time(attr, **kwargs): + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument """Serialize Time object into ISO-8601 formatted string. :param datetime.time attr: Object to be serialized. :rtype: str + :return: serialized time """ if isinstance(attr, str): attr = isodate.parse_time(attr) @@ -1103,30 +1089,32 @@ def serialize_time(attr, **kwargs): return t @staticmethod - def serialize_duration(attr, **kwargs): + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument """Serialize TimeDelta object into ISO-8601 formatted string. :param TimeDelta attr: Object to be serialized. :rtype: str + :return: serialized duration """ if isinstance(attr, str): attr = isodate.parse_duration(attr) return isodate.duration_isoformat(attr) @staticmethod - def serialize_rfc(attr, **kwargs): + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into RFC-1123 formatted string. :param Datetime attr: Object to be serialized. :rtype: str - :raises: TypeError if format invalid. + :raises TypeError: if format invalid. + :return: serialized rfc """ try: if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() - except AttributeError: - raise TypeError("RFC1123 object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( Serializer.days[utc.tm_wday], @@ -1139,12 +1127,13 @@ def serialize_rfc(attr, **kwargs): ) @staticmethod - def serialize_iso(attr, **kwargs): + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into ISO-8601 formatted string. :param Datetime attr: Object to be serialized. :rtype: str - :raises: SerializationError if format invalid. + :raises SerializationError: if format invalid. + :return: serialized iso """ if isinstance(attr, str): attr = isodate.parse_datetime(attr) @@ -1170,13 +1159,14 @@ def serialize_iso(attr, **kwargs): raise TypeError(msg) from err @staticmethod - def serialize_unix(attr, **kwargs): + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into IntTime format. This is represented as seconds. :param Datetime attr: Object to be serialized. :rtype: int - :raises: SerializationError if format invalid + :raises SerializationError: if format invalid + :return: serialied unix """ if isinstance(attr, int): return attr @@ -1184,11 +1174,11 @@ def serialize_unix(attr, **kwargs): if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") return int(calendar.timegm(attr.utctimetuple())) - except AttributeError: - raise TypeError("Unix time object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc -def rest_key_extractor(attr, attr_desc, data): +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument key = attr_desc["key"] working_data = data @@ -1209,7 +1199,9 @@ def rest_key_extractor(attr, attr_desc, data): return working_data.get(key) -def rest_key_case_insensitive_extractor(attr, attr_desc, data): +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): key = attr_desc["key"] working_data = data @@ -1230,17 +1222,29 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): return attribute_key_case_insensitive_extractor(key, None, working_data) -def last_rest_key_extractor(attr, attr_desc, data): - """Extract the attribute in "data" based on the last part of the JSON path key.""" +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) return attribute_key_extractor(dict_keys[-1], None, data) -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument """Extract the attribute in "data" based on the last part of the JSON path key. This is the case insensitive version of "last_rest_key_extractor" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) @@ -1277,7 +1281,7 @@ def _extract_name_from_internal_type(internal_type): return xml_name -def xml_key_extractor(attr, attr_desc, data): +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements if isinstance(data, dict): return None @@ -1329,22 +1333,21 @@ def xml_key_extractor(attr, attr_desc, data): if is_iter_type: if is_wrapped: return None # is_wrapped no node, we want None - else: - return [] # not wrapped, assume empty list + return [] # not wrapped, assume empty list return None # Assume it's not there, maybe an optional node. # If is_iter_type and not wrapped, return all found children if is_iter_type: if not is_wrapped: return children - else: # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) + # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name ) - return list(children[0]) # Might be empty list and that's ok. + ) + return list(children[0]) # Might be empty list and that's ok. # Here it's not a itertype, we should have found one element only or empty if len(children) > 1: @@ -1352,7 +1355,7 @@ def xml_key_extractor(attr, attr_desc, data): return children[0] -class Deserializer(object): +class Deserializer: """Response object model deserializer. :param dict classes: Class type dictionary for deserializing complex types. @@ -1361,9 +1364,9 @@ class Deserializer(object): basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1399,27 +1402,29 @@ def __call__(self, target_obj, response_data, content_type=None): :param str target_obj: Target data type to deserialize to. :param requests.Response response_data: REST response object. :param str content_type: Swagger "produces" if available. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. + :rtype: object """ data = self._unpack_content(response_data, content_type) return self._deserialize(target_obj, data) - def _deserialize(self, target_obj, data): + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements """Call the deserializer on a model. Data needs to be already deserialized as JSON or XML ElementTree :param str target_obj: Target data type to deserialize to. :param object data: Object to deserialize. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. + :rtype: object """ # This is already a model, go recursive just in case if hasattr(data, "_attribute_map"): constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] try: - for attr, mapconfig in data._attribute_map.items(): + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access if attr in constants: continue value = getattr(data, attr) @@ -1438,13 +1443,13 @@ def _deserialize(self, target_obj, data): if isinstance(response, str): return self.deserialize_data(data, response) - elif isinstance(response, type) and issubclass(response, Enum): + if isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) if data is None or data is CoreNull: return data try: - attributes = response._attribute_map # type: ignore + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1474,9 +1479,8 @@ def _deserialize(self, target_obj, data): except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore raise DeserializationError(msg) from err - else: - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) def _build_additional_properties(self, attribute_map, data): if not self.additional_properties_detection: @@ -1503,6 +1507,8 @@ def _classify_target(self, target, data): :param str target: The target object type to deserialize to. :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple """ if target is None: return None, None @@ -1514,7 +1520,7 @@ def _classify_target(self, target, data): return target, target try: - target = target._classify(data, self.dependencies) # type: ignore + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1529,10 +1535,12 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): :param str target_obj: The target object type to deserialize to. :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object """ try: return self(target_obj, data, content_type=content_type) - except: + except: # pylint: disable=bare-except _LOGGER.debug( "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) @@ -1550,10 +1558,12 @@ def _unpack_content(raw_data, content_type=None): If raw_data is something else, bypass all logic and return it directly. - :param raw_data: Data to be processed. - :param content_type: How to parse if raw_data is a string/bytes. + :param obj raw_data: Data to be processed. + :param str content_type: How to parse if raw_data is a string/bytes. :raises JSONDecodeError: If JSON is requested and parsing is impossible. :raises UnicodeDecodeError: If bytes is not UTF8 + :rtype: object + :return: Unpacked content. """ # Assume this is enough to detect a Pipeline Response without importing it context = getattr(raw_data, "context", {}) @@ -1577,24 +1587,35 @@ def _unpack_content(raw_data, content_type=None): def _instantiate_model(self, response, attrs, additional_properties=None): """Instantiate a response model passing in deserialized args. - :param response: The response model class. - :param d_attrs: The deserialized response attributes. + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. """ if callable(response): subtype = getattr(response, "_subtype_map", {}) try: - readonly = [k for k, v in response._validation.items() if v.get("readonly")] - const = [k for k, v in response._validation.items() if v.get("constant")] + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") + ] kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} response_obj = response(**kwargs) for attr in readonly: setattr(response_obj, attr, attrs.get(attr)) if additional_properties: - response_obj.additional_properties = additional_properties + response_obj.additional_properties = additional_properties # type: ignore return response_obj except TypeError as err: msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) + raise DeserializationError(msg + str(err)) from err else: try: for attr, value in attrs.items(): @@ -1603,15 +1624,16 @@ def _instantiate_model(self, response, attrs, additional_properties=None): except Exception as exp: msg = "Unable to populate response model. " msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) + raise DeserializationError(msg) from exp - def deserialize_data(self, data, data_type): + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements """Process data for deserialization according to data type. :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. + :rtype: object """ if data is None: return data @@ -1625,7 +1647,11 @@ def deserialize_data(self, data, data_type): if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): return data - is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "object", + "[]", + r"{}", + ] if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: return None data_val = self.deserialize_type[data_type](data) @@ -1645,14 +1671,14 @@ def deserialize_data(self, data, data_type): msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) raise DeserializationError(msg) from err - else: - return self._deserialize(obj_type, data) + return self._deserialize(obj_type, data) def deserialize_iter(self, attr, iter_type): """Deserialize an iterable. :param list attr: Iterable to be deserialized. :param str iter_type: The type of object in the iterable. + :return: Deserialized iterable. :rtype: list """ if attr is None: @@ -1669,6 +1695,7 @@ def deserialize_dict(self, attr, dict_type): :param dict/list attr: Dictionary to be deserialized. Also accepts a list of key, value pairs. :param str dict_type: The object type of the items in the dictionary. + :return: Deserialized dictionary. :rtype: dict """ if isinstance(attr, list): @@ -1679,13 +1706,14 @@ def deserialize_dict(self, attr, dict_type): attr = {el.tag: el.text for el in attr} return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - def deserialize_object(self, attr, **kwargs): + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Deserialize a generic object. This will be handled as a dictionary. :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. :rtype: dict - :raises: TypeError if non-builtin datatype encountered. + :raises TypeError: if non-builtin datatype encountered. """ if attr is None: return None @@ -1718,11 +1746,10 @@ def deserialize_object(self, attr, **kwargs): pass return deserialized - else: - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) - def deserialize_basic(self, attr, data_type): + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements """Deserialize basic builtin data type from string. Will attempt to convert to str, int, float and bool. This function will also accept '1', '0', 'true' and 'false' as @@ -1730,8 +1757,9 @@ def deserialize_basic(self, attr, data_type): :param str attr: response string to be deserialized. :param str data_type: deserialization data type. + :return: Deserialized basic type. :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. + :raises TypeError: if string format is not valid. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1741,24 +1769,23 @@ def deserialize_basic(self, attr, data_type): if data_type == "str": # None or '', node is empty string. return "" - else: - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, str): + if isinstance(attr, str): if attr.lower() in ["true", "1"]: return True - elif attr.lower() in ["false", "0"]: + if attr.lower() in ["false", "0"]: return False raise TypeError("Invalid boolean value: {}".format(attr)) if data_type == "str": return self.deserialize_unicode(attr) - return eval(data_type)(attr) # nosec + return eval(data_type)(attr) # nosec # pylint: disable=eval-used @staticmethod def deserialize_unicode(data): @@ -1766,6 +1793,7 @@ def deserialize_unicode(data): as a string. :param str data: response string to be deserialized. + :return: Deserialized string. :rtype: str or unicode """ # We might be here because we have an enum modeled as string, @@ -1779,8 +1807,7 @@ def deserialize_unicode(data): return data except NameError: return str(data) - else: - return str(data) + return str(data) @staticmethod def deserialize_enum(data, enum_obj): @@ -1792,6 +1819,7 @@ def deserialize_enum(data, enum_obj): :param str data: Response string to be deserialized. If this value is None or invalid it will be returned as-is. :param Enum enum_obj: Enum object to deserialize to. + :return: Deserialized enum object. :rtype: Enum """ if isinstance(data, enum_obj) or data is None: @@ -1802,9 +1830,9 @@ def deserialize_enum(data, enum_obj): # Workaround. We might consider remove it in the future. try: return list(enum_obj.__members__.values())[data] - except IndexError: + except IndexError as exc: error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) + raise DeserializationError(error.format(data, enum_obj)) from exc try: return enum_obj(str(data)) except ValueError: @@ -1820,8 +1848,9 @@ def deserialize_bytearray(attr): """Deserialize string into bytearray. :param str attr: response string to be deserialized. + :return: Deserialized bytearray :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1832,8 +1861,9 @@ def deserialize_base64(attr): """Deserialize base64 encoded string into string. :param str attr: response string to be deserialized. + :return: Deserialized base64 string :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1847,8 +1877,9 @@ def deserialize_decimal(attr): """Deserialize string into Decimal object. :param str attr: response string to be deserialized. - :rtype: Decimal - :raises: DeserializationError if string format invalid. + :return: Deserialized decimal + :raises DeserializationError: if string format invalid. + :rtype: decimal """ if isinstance(attr, ET.Element): attr = attr.text @@ -1863,8 +1894,9 @@ def deserialize_long(attr): """Deserialize string into long (Py2) or int (Py3). :param str attr: response string to be deserialized. + :return: Deserialized int :rtype: long or int - :raises: ValueError if string format invalid. + :raises ValueError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1875,8 +1907,9 @@ def deserialize_duration(attr): """Deserialize ISO-8601 formatted string into TimeDelta object. :param str attr: response string to be deserialized. + :return: Deserialized duration :rtype: TimeDelta - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1885,16 +1918,16 @@ def deserialize_duration(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." raise DeserializationError(msg) from err - else: - return duration + return duration @staticmethod def deserialize_date(attr): """Deserialize ISO-8601 formatted string into Date object. :param str attr: response string to be deserialized. + :return: Deserialized date :rtype: Date - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1908,8 +1941,9 @@ def deserialize_time(attr): """Deserialize ISO-8601 formatted string into time object. :param str attr: response string to be deserialized. + :return: Deserialized time :rtype: datetime.time - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1922,31 +1956,32 @@ def deserialize_rfc(attr): """Deserialize RFC-1123 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text try: parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) except ValueError as err: msg = "Cannot deserialize to rfc datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_iso(attr): """Deserialize ISO-8601 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1974,8 +2009,7 @@ def deserialize_iso(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_unix(attr): @@ -1983,8 +2017,9 @@ def deserialize_unix(attr): This is represented as seconds. :param int attr: Object to be serialized. + :return: Deserialized datetime :rtype: Datetime - :raises: DeserializationError if format invalid + :raises DeserializationError: if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore @@ -1994,5 +2029,4 @@ def deserialize_unix(attr): except ValueError as err: msg = "Cannot deserialize to unix datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj 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..59deb8c7263b 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.1.0" diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/__init__.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/__init__.py index 8e33564fdf32..9142fa0b2470 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/__init__.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._sc_vmm_mgmt_client import ScVmmMgmtClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._sc_vmm_mgmt_client import ScVmmMgmtClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "ScVmmMgmtClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() 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..3a932c4de89d 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 @@ -14,11 +14,10 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ScVmmMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class ScVmmMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for ScVmmMgmtClient. Note that all parameters used to create this instance are saved as instance @@ -28,13 +27,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 "2025-03-13". 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", "2025-03-13") 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..f4165f7dec08 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 @@ -7,15 +7,18 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models -from .._serialization import Deserializer, Serializer +from .._utils.serialization import Deserializer, Serializer from ._configuration import ScVmmMgmtClientConfiguration from .operations import ( AvailabilitySetsOperations, @@ -31,11 +34,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ScVmmMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class ScVmmMgmtClient: # pylint: disable=too-many-instance-attributes """The Microsoft.ScVmm Rest API spec. :ivar virtual_machine_instances: VirtualMachineInstancesOperations operations @@ -66,9 +68,9 @@ class ScVmmMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too :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 - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :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 "2025-03-13". 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 @@ -76,13 +78,17 @@ class ScVmmMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = ScVmmMgmtClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ScVmmMgmtClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -101,7 +107,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -155,7 +163,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/__init__.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/__init__.py index b8f71f095a0c..d5261231a533 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/__init__.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/__init__.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,20 +6,26 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._virtual_machine_instances_operations import VirtualMachineInstancesOperations -from ._guest_agents_operations import GuestAgentsOperations -from ._vm_instance_hybrid_identity_metadatas_operations import VmInstanceHybridIdentityMetadatasOperations -from ._operations import Operations -from ._availability_sets_operations import AvailabilitySetsOperations -from ._clouds_operations import CloudsOperations -from ._virtual_machine_templates_operations import VirtualMachineTemplatesOperations -from ._virtual_networks_operations import VirtualNetworksOperations -from ._vmm_servers_operations import VmmServersOperations -from ._inventory_items_operations import InventoryItemsOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._virtual_machine_instances_operations import VirtualMachineInstancesOperations # type: ignore +from ._guest_agents_operations import GuestAgentsOperations # type: ignore +from ._vm_instance_hybrid_identity_metadatas_operations import VmInstanceHybridIdentityMetadatasOperations # type: ignore +from ._operations import Operations # type: ignore +from ._availability_sets_operations import AvailabilitySetsOperations # type: ignore +from ._clouds_operations import CloudsOperations # type: ignore +from ._virtual_machine_templates_operations import VirtualMachineTemplatesOperations # type: ignore +from ._virtual_networks_operations import VirtualNetworksOperations # type: ignore +from ._vmm_servers_operations import VmmServersOperations # type: ignore +from ._inventory_items_operations import InventoryItemsOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -33,5 +40,5 @@ "VmmServersOperations", "InventoryItemsOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() 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..7c8727a52a29 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping 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, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -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,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request +from ..._utils.serialization import Deserializer, Serializer from ...operations._availability_sets_operations import ( build_create_or_update_request, build_delete_request, @@ -40,11 +41,8 @@ build_list_by_subscription_request, build_update_request, ) +from .._configuration import ScVmmMgmtClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,10 +61,10 @@ class AvailabilitySetsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ScVmmMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.AvailabilitySet"]: @@ -84,7 +82,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Availabi api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailabilitySetListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -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 @@ -168,7 +164,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailabilitySetListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -186,7 +182,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -202,7 +197,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -249,7 +243,7 @@ async def get( :rtype: ~azure.mgmt.scvmm.models.AvailabilitySet :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -271,7 +265,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -286,7 +279,7 @@ async def get( 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,8 +292,8 @@ async def _create_or_update_initial( availability_set_resource_name: str, resource: Union[_models.AvailabilitySet, IO[bytes]], **kwargs: Any - ) -> _models.AvailabilitySet: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -313,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.AvailabilitySet] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -334,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 ) @@ -345,21 +338,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 +466,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,8 +501,8 @@ async def _update_initial( availability_set_resource_name: str, properties: Union[_models.AvailabilitySetTagsUpdate, IO[bytes]], **kwargs: Any - ) -> Optional[_models.AvailabilitySet]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -520,7 +515,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 +536,10 @@ async def _update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -552,19 +547,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 +673,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,14 +702,14 @@ 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: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -723,7 +721,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 +732,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 +743,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 +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( @@ -793,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, availability_set_resource_name=availability_set_resource_name, force=force, @@ -803,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/_clouds_operations.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/aio/operations/_clouds_operations.py index 9aedd2c897d7..26fd42b8c8ac 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping 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, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -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,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request +from ..._utils.serialization import Deserializer, Serializer from ...operations._clouds_operations import ( build_create_or_update_request, build_delete_request, @@ -40,11 +41,8 @@ build_list_by_subscription_request, build_update_request, ) +from .._configuration import ScVmmMgmtClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,10 +61,10 @@ class CloudsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ScVmmMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Cloud"]: @@ -84,7 +82,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Cloud"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CloudListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -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 @@ -166,7 +162,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CloudListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -184,7 +180,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -200,7 +195,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -245,7 +239,7 @@ async def get(self, resource_group_name: str, cloud_resource_name: str, **kwargs :rtype: ~azure.mgmt.scvmm.models.Cloud :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -267,7 +261,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 +275,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,8 +288,8 @@ async def _create_or_update_initial( cloud_resource_name: str, resource: Union[_models.Cloud, IO[bytes]], **kwargs: Any - ) -> _models.Cloud: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -309,7 +302,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 +323,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -341,18 +334,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 +456,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,8 +491,8 @@ async def _update_initial( cloud_resource_name: str, properties: Union[_models.CloudTagsUpdate, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Cloud]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -510,7 +505,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 +526,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 +537,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 +660,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,14 +689,14 @@ 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: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -710,7 +708,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 +719,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 +730,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 +743,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 +783,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 +793,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..9680f1addfb0 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping 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, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -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,18 +32,15 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request +from ..._utils.serialization import Deserializer, Serializer from ...operations._guest_agents_operations import ( build_create_request, build_delete_request, build_get_request, build_list_by_virtual_machine_instance_request, ) +from .._configuration import ScVmmMgmtClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -61,10 +59,10 @@ class GuestAgentsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ScVmmMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_virtual_machine_instance(self, resource_uri: str, **kwargs: Any) -> AsyncIterable["_models.GuestAgent"]: @@ -85,7 +83,7 @@ def list_by_virtual_machine_instance(self, resource_uri: str, **kwargs: Any) -> api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GuestAgentListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -102,7 +100,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -118,7 +115,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -161,7 +157,7 @@ async def get(self, resource_uri: str, **kwargs: Any) -> _models.GuestAgent: :rtype: ~azure.mgmt.scvmm.models.GuestAgent :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -181,7 +177,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 +191,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,8 +200,8 @@ 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: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -219,7 +214,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 +233,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 +244,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 +346,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 @@ -379,7 +376,7 @@ def get_long_running_output(pipeline_response): ) @distributed_trace_async - async def delete(self, resource_uri: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + async def delete(self, resource_uri: str, **kwargs: Any) -> None: """Deletes a GuestAgent resource. Implements GuestAgent DELETE method. @@ -391,7 +388,7 @@ async def delete(self, resource_uri: str, **kwargs: Any) -> None: # pylint: dis :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -411,7 +408,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..719c58af4e4a 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -21,26 +21,22 @@ 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 ..._utils.serialization import Deserializer, Serializer from ...operations._inventory_items_operations import ( build_create_request, build_delete_request, build_get_request, build_list_by_vmm_server_request, ) +from .._configuration import ScVmmMgmtClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -59,10 +55,10 @@ class InventoryItemsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ScVmmMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_vmm_server( @@ -87,7 +83,7 @@ def list_by_vmm_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.InventoryItemListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -106,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: @@ -122,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 @@ -171,7 +165,7 @@ async def get( :rtype: ~azure.mgmt.scvmm.models.InventoryItem :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -194,7 +188,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -209,7 +202,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 @@ -307,7 +300,7 @@ async def create( :rtype: ~azure.mgmt.scvmm.models.InventoryItem :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -342,7 +335,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -357,11 +349,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 @@ -369,7 +357,7 @@ async def create( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, vmm_server_name: str, inventory_item_resource_name: str, **kwargs: Any ) -> None: """Implements inventoryItem DELETE method. @@ -387,7 +375,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -410,7 +398,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..fb59b541ab77 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -20,20 +20,16 @@ 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 ..._utils.serialization import Deserializer, Serializer from ...operations._operations import build_list_request +from .._configuration import ScVmmMgmtClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -52,10 +48,10 @@ class Operations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ScVmmMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -71,7 +67,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -87,7 +83,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 +98,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..101f0bd34b09 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping 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, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,12 +19,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 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request +from ..._utils.serialization import Deserializer, Serializer from ...operations._virtual_machine_instances_operations import ( build_create_checkpoint_request, build_create_or_update_request, @@ -45,11 +47,8 @@ build_stop_request, build_update_request, ) +from .._configuration import ScVmmMgmtClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,10 +67,10 @@ class VirtualMachineInstancesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ScVmmMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list(self, resource_uri: str, **kwargs: Any) -> AsyncIterable["_models.VirtualMachineInstance"]: @@ -94,7 +93,7 @@ def list(self, resource_uri: str, **kwargs: Any) -> AsyncIterable["_models.Virtu api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachineInstanceListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -111,7 +110,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -127,7 +125,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -170,7 +167,7 @@ async def get(self, resource_uri: str, **kwargs: Any) -> _models.VirtualMachineI :rtype: ~azure.mgmt.scvmm.models.VirtualMachineInstance :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -190,7 +187,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 +201,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,8 +210,8 @@ 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: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -228,7 +224,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 +243,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 +254,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 +364,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,8 +395,8 @@ 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]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -411,7 +409,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 +428,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 +439,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 +547,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,14 +576,14 @@ 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: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -594,7 +595,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 +605,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 +616,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 +629,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 +670,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 +680,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,10 +705,10 @@ 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: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -711,7 +721,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 +740,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 +751,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 +763,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 +845,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 +855,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,10 +879,10 @@ 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: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -876,7 +895,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 +914,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 +925,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 +937,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 +1019,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 +1029,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,10 +1053,8 @@ 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: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + async def _restart_initial(self, resource_uri: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1040,7 +1066,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 +1074,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 +1085,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 +1097,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 +1126,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 +1134,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,10 +1158,10 @@ 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: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1139,7 +1174,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 +1193,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 +1204,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 +1216,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 +1298,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 +1308,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,10 +1332,8 @@ 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: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + async def _start_initial(self, resource_uri: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1303,7 +1345,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 +1353,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 +1364,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 +1376,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 +1405,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 +1413,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,10 +1437,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - async def _stop_initial( # pylint: disable=inconsistent-return-statements - self, resource_uri: str, body: Union[_models.StopVirtualMachineOptions, IO[bytes]], **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + async def _stop_initial( + self, + resource_uri: str, + body: Optional[Union[_models.StopVirtualMachineOptions, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1402,7 +1456,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 +1464,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 +1478,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 +1489,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 +1501,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 +1524,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 +1536,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 +1550,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 +1562,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 +1575,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 +1591,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 +1601,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..23d7c1f79b96 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping 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, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -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,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request +from ..._utils.serialization import Deserializer, Serializer from ...operations._virtual_machine_templates_operations import ( build_create_or_update_request, build_delete_request, @@ -40,11 +41,8 @@ build_list_by_subscription_request, build_update_request, ) +from .._configuration import ScVmmMgmtClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,10 +61,10 @@ class VirtualMachineTemplatesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ScVmmMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.VirtualMachineTemplate"]: @@ -86,7 +84,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.VirtualM api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachineTemplateListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -103,7 +101,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -119,7 +116,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -172,7 +168,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachineTemplateListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -190,7 +186,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -206,7 +201,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -253,7 +247,7 @@ async def get( :rtype: ~azure.mgmt.scvmm.models.VirtualMachineTemplate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -275,7 +269,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -290,7 +283,7 @@ async def get( 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,8 +296,8 @@ async def _create_or_update_initial( virtual_machine_template_name: str, resource: Union[_models.VirtualMachineTemplate, IO[bytes]], **kwargs: Any - ) -> _models.VirtualMachineTemplate: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -317,7 +310,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 +331,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -349,18 +342,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 +467,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,8 +502,8 @@ async def _update_initial( virtual_machine_template_name: str, properties: Union[_models.VirtualMachineTemplateTagsUpdate, IO[bytes]], **kwargs: Any - ) -> Optional[_models.VirtualMachineTemplate]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -521,7 +516,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 +537,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 +548,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 +674,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,14 +703,14 @@ 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: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -724,7 +722,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 +733,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 +744,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 +757,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 +797,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 +807,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..5de4bccab36f 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping 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, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -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,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request +from ..._utils.serialization import Deserializer, Serializer from ...operations._virtual_networks_operations import ( build_create_or_update_request, build_delete_request, @@ -40,11 +41,8 @@ build_list_by_subscription_request, build_update_request, ) +from .._configuration import ScVmmMgmtClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,10 +61,10 @@ class VirtualNetworksOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ScVmmMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.VirtualNetwork"]: @@ -84,7 +82,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.VirtualN api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualNetworkListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -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 @@ -168,7 +164,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualNetworkListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -186,7 +182,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -202,7 +197,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -247,7 +241,7 @@ async def get(self, resource_group_name: str, virtual_network_name: str, **kwarg :rtype: ~azure.mgmt.scvmm.models.VirtualNetwork :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -269,7 +263,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 +277,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,8 +290,8 @@ async def _create_or_update_initial( virtual_network_name: str, resource: Union[_models.VirtualNetwork, IO[bytes]], **kwargs: Any - ) -> _models.VirtualNetwork: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -311,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.VirtualNetwork] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -332,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 ) @@ -343,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("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 +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("VirtualNetwork", pipeline_response) + deserialized = self._deserialize("VirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -501,8 +496,8 @@ async def _update_initial( virtual_network_name: str, properties: Union[_models.VirtualNetworkTagsUpdate, IO[bytes]], **kwargs: Any - ) -> Optional[_models.VirtualNetwork]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -515,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.VirtualNetwork]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -536,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 ) @@ -547,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("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 +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("VirtualNetwork", pipeline_response) + deserialized = self._deserialize("VirtualNetwork", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -699,14 +697,14 @@ 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: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -718,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, @@ -729,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 ) @@ -740,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) @@ -749,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( @@ -785,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, virtual_network_name=virtual_network_name, force=force, @@ -795,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/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..99a26f6f86a5 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -20,24 +20,20 @@ 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 ..._utils.serialization import Deserializer, Serializer from ...operations._vm_instance_hybrid_identity_metadatas_operations import ( build_get_request, build_list_by_virtual_machine_instance_request, ) +from .._configuration import ScVmmMgmtClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,10 +52,10 @@ class VmInstanceHybridIdentityMetadatasOperations: # pylint: disable=name-too-l def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ScVmmMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_virtual_machine_instance( @@ -84,7 +80,7 @@ def list_by_virtual_machine_instance( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VmInstanceHybridIdentityMetadataListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -101,7 +97,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -117,7 +112,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -160,7 +154,7 @@ async def get(self, resource_uri: str, **kwargs: Any) -> _models.VmInstanceHybri :rtype: ~azure.mgmt.scvmm.models.VmInstanceHybridIdentityMetadata :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -180,7 +174,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 +188,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..6777a6b4e9ef 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping 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, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -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,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request +from ..._utils.serialization import Deserializer, Serializer from ...operations._vmm_servers_operations import ( build_create_or_update_request, build_delete_request, @@ -40,11 +41,8 @@ build_list_by_subscription_request, build_update_request, ) +from .._configuration import ScVmmMgmtClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,10 +61,10 @@ class VmmServersOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ScVmmMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.VmmServer"]: @@ -84,7 +82,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.VmmServe api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VmmServerListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -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 @@ -166,7 +162,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VmmServerListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -184,7 +180,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -200,7 +195,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -245,7 +239,7 @@ async def get(self, resource_group_name: str, vmm_server_name: str, **kwargs: An :rtype: ~azure.mgmt.scvmm.models.VmmServer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -267,7 +261,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 +275,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,8 +288,8 @@ async def _create_or_update_initial( vmm_server_name: str, resource: Union[_models.VmmServer, IO[bytes]], **kwargs: Any - ) -> _models.VmmServer: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -309,7 +302,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 +323,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -341,18 +334,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 +459,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,8 +494,8 @@ async def _update_initial( vmm_server_name: str, properties: Union[_models.VmmServerTagsUpdate, IO[bytes]], **kwargs: Any - ) -> Optional[_models.VmmServer]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -513,7 +508,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 +529,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 +540,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 +666,11 @@ async def begin_update( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VmmServer", pipeline_response) + deserialized = self._deserialize("VmmServer", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -697,14 +695,14 @@ 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: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -716,7 +714,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 +725,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 +736,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 +749,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 +789,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 +799,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/__init__.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/models/__init__.py index 841ca37970c8..8aa2ead82fb0 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/models/__init__.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/models/__init__.py @@ -5,101 +5,112 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import AvailabilitySet -from ._models_py3 import AvailabilitySetListItem -from ._models_py3 import AvailabilitySetListResult -from ._models_py3 import AvailabilitySetProperties -from ._models_py3 import AvailabilitySetTagsUpdate -from ._models_py3 import Checkpoint -from ._models_py3 import Cloud -from ._models_py3 import CloudCapacity -from ._models_py3 import CloudInventoryItem -from ._models_py3 import CloudListResult -from ._models_py3 import CloudProperties -from ._models_py3 import CloudTagsUpdate -from ._models_py3 import ErrorAdditionalInfo -from ._models_py3 import ErrorDetail -from ._models_py3 import ErrorResponse -from ._models_py3 import ExtendedLocation -from ._models_py3 import GuestAgent -from ._models_py3 import GuestAgentListResult -from ._models_py3 import GuestAgentProperties -from ._models_py3 import GuestCredential -from ._models_py3 import HardwareProfile -from ._models_py3 import HardwareProfileUpdate -from ._models_py3 import HttpProxyConfiguration -from ._models_py3 import InfrastructureProfile -from ._models_py3 import InfrastructureProfileUpdate -from ._models_py3 import InventoryItem -from ._models_py3 import InventoryItemDetails -from ._models_py3 import InventoryItemListResult -from ._models_py3 import InventoryItemProperties -from ._models_py3 import NetworkInterface -from ._models_py3 import NetworkInterfaceUpdate -from ._models_py3 import NetworkProfile -from ._models_py3 import NetworkProfileUpdate -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import OsProfileForVmInstance -from ._models_py3 import ProxyResource -from ._models_py3 import Resource -from ._models_py3 import StopVirtualMachineOptions -from ._models_py3 import StorageProfile -from ._models_py3 import StorageProfileUpdate -from ._models_py3 import StorageQosPolicy -from ._models_py3 import StorageQosPolicyDetails -from ._models_py3 import SystemData -from ._models_py3 import TrackedResource -from ._models_py3 import VirtualDisk -from ._models_py3 import VirtualDiskUpdate -from ._models_py3 import VirtualMachineCreateCheckpoint -from ._models_py3 import VirtualMachineDeleteCheckpoint -from ._models_py3 import VirtualMachineInstance -from ._models_py3 import VirtualMachineInstanceListResult -from ._models_py3 import VirtualMachineInstanceProperties -from ._models_py3 import VirtualMachineInstanceUpdate -from ._models_py3 import VirtualMachineInstanceUpdateProperties -from ._models_py3 import VirtualMachineInventoryItem -from ._models_py3 import VirtualMachineRestoreCheckpoint -from ._models_py3 import VirtualMachineTemplate -from ._models_py3 import VirtualMachineTemplateInventoryItem -from ._models_py3 import VirtualMachineTemplateListResult -from ._models_py3 import VirtualMachineTemplateProperties -from ._models_py3 import VirtualMachineTemplateTagsUpdate -from ._models_py3 import VirtualNetwork -from ._models_py3 import VirtualNetworkInventoryItem -from ._models_py3 import VirtualNetworkListResult -from ._models_py3 import VirtualNetworkProperties -from ._models_py3 import VirtualNetworkTagsUpdate -from ._models_py3 import VmInstanceHybridIdentityMetadata -from ._models_py3 import VmInstanceHybridIdentityMetadataListResult -from ._models_py3 import VmInstanceHybridIdentityMetadataProperties -from ._models_py3 import VmmCredential -from ._models_py3 import VmmServer -from ._models_py3 import VmmServerListResult -from ._models_py3 import VmmServerProperties -from ._models_py3 import VmmServerTagsUpdate +from typing import TYPE_CHECKING -from ._sc_vmm_mgmt_client_enums import ActionType -from ._sc_vmm_mgmt_client_enums import AllocationMethod -from ._sc_vmm_mgmt_client_enums import CreateDiffDisk -from ._sc_vmm_mgmt_client_enums import CreatedByType -from ._sc_vmm_mgmt_client_enums import DeleteFromHost -from ._sc_vmm_mgmt_client_enums import DynamicMemoryEnabled -from ._sc_vmm_mgmt_client_enums import ForceDelete -from ._sc_vmm_mgmt_client_enums import InventoryType -from ._sc_vmm_mgmt_client_enums import IsCustomizable -from ._sc_vmm_mgmt_client_enums import IsHighlyAvailable -from ._sc_vmm_mgmt_client_enums import LimitCpuForMigration -from ._sc_vmm_mgmt_client_enums import Origin -from ._sc_vmm_mgmt_client_enums import OsType -from ._sc_vmm_mgmt_client_enums import ProvisioningAction -from ._sc_vmm_mgmt_client_enums import ProvisioningState -from ._sc_vmm_mgmt_client_enums import SkipShutdown +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + AvailabilitySet, + AvailabilitySetListItem, + AvailabilitySetListResult, + AvailabilitySetProperties, + AvailabilitySetTagsUpdate, + Checkpoint, + Cloud, + CloudCapacity, + CloudInventoryItem, + CloudListResult, + CloudProperties, + CloudTagsUpdate, + ErrorAdditionalInfo, + ErrorDetail, + ErrorResponse, + ExtendedLocation, + GuestAgent, + GuestAgentListResult, + GuestAgentProperties, + GuestCredential, + HardwareProfile, + HardwareProfileUpdate, + HttpProxyConfiguration, + InfrastructureProfile, + InfrastructureProfileUpdate, + InventoryItem, + InventoryItemDetails, + InventoryItemListResult, + InventoryItemProperties, + NetworkInterface, + NetworkInterfaceUpdate, + NetworkProfile, + NetworkProfileUpdate, + Operation, + OperationDisplay, + OperationListResult, + OsProfileForVmInstance, + ProxyResource, + Resource, + StopVirtualMachineOptions, + StorageProfile, + StorageProfileUpdate, + StorageQosPolicy, + StorageQosPolicyDetails, + SystemData, + TrackedResource, + VirtualDisk, + VirtualDiskUpdate, + VirtualMachineCreateCheckpoint, + VirtualMachineDeleteCheckpoint, + VirtualMachineInstance, + VirtualMachineInstanceListResult, + VirtualMachineInstanceProperties, + VirtualMachineInstanceUpdate, + VirtualMachineInstanceUpdateProperties, + VirtualMachineInventoryItem, + VirtualMachineRestoreCheckpoint, + VirtualMachineTemplate, + VirtualMachineTemplateInventoryItem, + VirtualMachineTemplateListResult, + VirtualMachineTemplateProperties, + VirtualMachineTemplateTagsUpdate, + VirtualNetwork, + VirtualNetworkInventoryItem, + VirtualNetworkListResult, + VirtualNetworkProperties, + VirtualNetworkTagsUpdate, + VmInstanceHybridIdentityMetadata, + VmInstanceHybridIdentityMetadataListResult, + VmInstanceHybridIdentityMetadataProperties, + VmmCredential, + VmmServer, + VmmServerListResult, + VmmServerProperties, + VmmServerTagsUpdate, +) + +from ._sc_vmm_mgmt_client_enums import ( # type: ignore + ActionType, + AllocationMethod, + CreateDiffDisk, + CreatedByType, + DeleteFromHost, + DynamicMemoryEnabled, + ForceDelete, + InventoryType, + IsCustomizable, + IsHighlyAvailable, + LimitCpuForMigration, + Origin, + OsType, + ProvisioningAction, + ProvisioningState, + SkipShutdown, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -195,5 +206,5 @@ "ProvisioningState", "SkipShutdown", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() 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..4c1fedfce847 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 @@ -1,5 +1,5 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 -# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -10,10 +10,9 @@ import datetime from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union -from .. import _serialization +from .._utils import serialization as _serialization if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models @@ -23,7 +22,7 @@ class Resource(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -52,10 +51,10 @@ class Resource(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.system_data: Optional["_models.SystemData"] = None class TrackedResource(Resource): @@ -67,7 +66,7 @@ class TrackedResource(Resource): All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -120,7 +119,7 @@ class AvailabilitySet(TrackedResource): All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -246,7 +245,7 @@ def __init__(self, *, value: List["_models.AvailabilitySet"], **kwargs: Any) -> """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class AvailabilitySetProperties(_serialization.Model): @@ -286,7 +285,7 @@ def __init__( super().__init__(**kwargs) self.availability_set_name = availability_set_name self.vmm_server_id = vmm_server_id - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None class AvailabilitySetTagsUpdate(_serialization.Model): @@ -363,7 +362,7 @@ class Cloud(TrackedResource): All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -439,26 +438,31 @@ class CloudCapacity(_serialization.Model): :vartype memory_mb: int :ivar vm_count: VMCount gives the max number of VMs that can be deployed in the cloud. :vartype vm_count: int + :ivar storage_gb: StorageGB gives the storage in GB present in the cloud. + :vartype storage_gb: int """ _validation = { "cpu_count": {"readonly": True}, "memory_mb": {"readonly": True}, "vm_count": {"readonly": True}, + "storage_gb": {"readonly": True}, } _attribute_map = { "cpu_count": {"key": "cpuCount", "type": "int"}, "memory_mb": {"key": "memoryMB", "type": "int"}, "vm_count": {"key": "vmCount", "type": "int"}, + "storage_gb": {"key": "storageGB", "type": "int"}, } def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.cpu_count = None - self.memory_mb = None - self.vm_count = None + self.cpu_count: Optional[int] = None + self.memory_mb: Optional[int] = None + self.vm_count: Optional[int] = None + self.storage_gb: Optional[int] = None class InventoryItemProperties(_serialization.Model): @@ -516,10 +520,10 @@ def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.inventory_type: Optional[str] = None - self.managed_resource_id = None - self.uuid = None - self.inventory_item_name = None - self.provisioning_state = None + self.managed_resource_id: Optional[str] = None + self.uuid: Optional[str] = None + self.inventory_item_name: Optional[str] = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None class CloudInventoryItem(InventoryItemProperties): @@ -596,7 +600,7 @@ def __init__(self, *, value: List["_models.Cloud"], **kwargs: Any) -> None: """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class CloudProperties(_serialization.Model): @@ -659,10 +663,10 @@ def __init__( self.inventory_item_id = inventory_item_id self.uuid = uuid self.vmm_server_id = vmm_server_id - self.cloud_name = None - self.cloud_capacity = None - self.storage_qos_policies = None - self.provisioning_state = None + self.cloud_name: Optional[str] = None + self.cloud_capacity: Optional["_models.CloudCapacity"] = None + self.storage_qos_policies: Optional[List["_models.StorageQosPolicy"]] = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None class CloudTagsUpdate(_serialization.Model): @@ -709,8 +713,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorDetail(_serialization.Model): @@ -749,11 +753,11 @@ class ErrorDetail(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorDetail"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ErrorResponse(_serialization.Model): @@ -810,7 +814,7 @@ class ProxyResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -829,7 +833,7 @@ class GuestAgent(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -897,7 +901,7 @@ def __init__(self, *, value: List["_models.GuestAgent"], **kwargs: Any) -> None: """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class GuestAgentProperties(_serialization.Model): @@ -921,6 +925,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 +945,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 +954,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,15 +965,19 @@ 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 + self.uuid: Optional[str] = None self.credentials = credentials self.http_proxy_config = http_proxy_config self.provisioning_action = provisioning_action - self.status = None - self.custom_resource_name = None - self.provisioning_state = None + self.status: Optional[str] = None + self.custom_resource_name: Optional[str] = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None + self.private_link_scope_resource_id = private_link_scope_resource_id class GuestCredential(_serialization.Model): @@ -1072,7 +1085,7 @@ def __init__( self.dynamic_memory_enabled = dynamic_memory_enabled self.dynamic_memory_max_mb = dynamic_memory_max_mb self.dynamic_memory_min_mb = dynamic_memory_min_mb - self.is_highly_available = None + self.is_highly_available: Optional[Union[str, "_models.IsHighlyAvailable"]] = None class HardwareProfileUpdate(_serialization.Model): @@ -1159,7 +1172,7 @@ def __init__(self, *, https_proxy: Optional[str] = None, **kwargs: Any) -> None: self.https_proxy = https_proxy -class InfrastructureProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes +class InfrastructureProfile(_serialization.Model): """Specifies the vmmServer infrastructure specific settings for the virtual machine instance. Variables are only populated by the server, and will be ignored when sending a request. @@ -1249,8 +1262,8 @@ def __init__( self.template_id = template_id self.vm_name = vm_name self.uuid = uuid - self.last_restored_vm_checkpoint = None - self.checkpoints = None + self.last_restored_vm_checkpoint: Optional["_models.Checkpoint"] = None + self.checkpoints: Optional[List["_models.Checkpoint"]] = None self.checkpoint_type = checkpoint_type self.generation = generation self.bios_guid = bios_guid @@ -1283,7 +1296,7 @@ class InventoryItem(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1395,10 +1408,10 @@ def __init__(self, *, value: List["_models.InventoryItem"], **kwargs: Any) -> No """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None -class NetworkInterface(_serialization.Model): # pylint: disable=too-many-instance-attributes +class NetworkInterface(_serialization.Model): """Network Interface model. Variables are only populated by the server, and will be ignored when sending a request. @@ -1488,12 +1501,12 @@ def __init__( """ super().__init__(**kwargs) self.name = name - self.display_name = None - self.ipv4_addresses = None - self.ipv6_addresses = None + self.display_name: Optional[str] = None + self.ipv4_addresses: Optional[List[str]] = None + self.ipv6_addresses: Optional[List[str]] = None self.mac_address = mac_address self.virtual_network_id = virtual_network_id - self.network_name = None + self.network_name: Optional[str] = None self.ipv4_address_type = ipv4_address_type self.ipv6_address_type = ipv6_address_type self.mac_address_type = mac_address_type @@ -1664,11 +1677,11 @@ def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kw :paramtype display: ~azure.mgmt.scvmm.models.OperationDisplay """ super().__init__(**kwargs) - self.name = None - self.is_data_action = None + self.name: Optional[str] = None + self.is_data_action: Optional[bool] = None self.display = display - self.origin = None - self.action_type = None + self.origin: Optional[Union[str, "_models.Origin"]] = None + self.action_type: Optional[Union[str, "_models.ActionType"]] = None class OperationDisplay(_serialization.Model): @@ -1707,10 +1720,10 @@ class OperationDisplay(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provider = None - self.resource = None - self.operation = None - self.description = None + self.provider: Optional[str] = None + self.resource: Optional[str] = None + self.operation: Optional[str] = None + self.description: Optional[str] = None class OperationListResult(_serialization.Model): @@ -1738,8 +1751,8 @@ class OperationListResult(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.value = None - self.next_link = None + self.value: Optional[List["_models.Operation"]] = None + self.next_link: Optional[str] = None class OsProfileForVmInstance(_serialization.Model): @@ -1747,6 +1760,8 @@ class OsProfileForVmInstance(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. + :ivar admin_username: Gets or sets the admin username. + :vartype admin_username: str :ivar admin_password: Admin password of the virtual machine. :vartype admin_password: str :ivar computer_name: Gets or sets computer name. @@ -1757,6 +1772,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 = { @@ -1766,28 +1796,73 @@ class OsProfileForVmInstance(_serialization.Model): } _attribute_map = { + "admin_username": {"key": "adminUsername", "type": "str"}, "admin_password": {"key": "adminPassword", "type": "str"}, "computer_name": {"key": "computerName", "type": "str"}, "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_username: Optional[str] = None, + 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_username: Gets or sets the admin username. + :paramtype admin_username: str :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 - """ - super().__init__(**kwargs) + :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_username = admin_username self.admin_password = admin_password self.computer_name = computer_name - self.os_type = None - self.os_sku = None - self.os_version = None + self.os_type: Optional[Union[str, "_models.OsType"]] = None + self.os_sku: Optional[str] = None + self.os_version: Optional[str] = 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): @@ -2010,7 +2085,7 @@ def __init__( self.last_modified_at = last_modified_at -class VirtualDisk(_serialization.Model): # pylint: disable=too-many-instance-attributes +class VirtualDisk(_serialization.Model): """Virtual disk model. Variables are only populated by the server, and will be ignored when sending a request. @@ -2111,16 +2186,16 @@ def __init__( """ super().__init__(**kwargs) self.name = name - self.display_name = None + self.display_name: Optional[str] = None self.disk_id = disk_id self.disk_size_gb = disk_size_gb - self.max_disk_size_gb = None + self.max_disk_size_gb: Optional[int] = None self.bus = bus self.lun = lun self.bus_type = bus_type self.vhd_type = vhd_type - self.volume_type = None - self.vhd_format_type = None + self.volume_type: Optional[str] = None + self.vhd_format_type: Optional[str] = None self.template_disk_id = template_disk_id self.storage_qos_policy = storage_qos_policy self.create_diff_disk = create_diff_disk @@ -2254,7 +2329,7 @@ class VirtualMachineInstance(ProxyResource): All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -2335,7 +2410,7 @@ def __init__(self, *, value: List["_models.VirtualMachineInstance"], **kwargs: A """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class VirtualMachineInstanceProperties(_serialization.Model): @@ -2410,8 +2485,8 @@ def __init__( self.network_profile = network_profile self.storage_profile = storage_profile self.infrastructure_profile = infrastructure_profile - self.power_state = None - self.provisioning_state = None + self.power_state: Optional[str] = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None class VirtualMachineInstanceUpdate(_serialization.Model): @@ -2489,7 +2564,7 @@ def __init__( self.infrastructure_profile = infrastructure_profile -class VirtualMachineInventoryItem(InventoryItemProperties): # pylint: disable=too-many-instance-attributes +class VirtualMachineInventoryItem(InventoryItemProperties): """The Virtual machine inventory item. Variables are only populated by the server, and will be ignored when sending a request. @@ -2517,6 +2592,8 @@ class VirtualMachineInventoryItem(InventoryItemProperties): # pylint: disable=t :vartype os_version: str :ivar power_state: Gets the power state of the virtual machine. :vartype power_state: str + :ivar generation: Gets vm generation. + :vartype generation: int :ivar ip_addresses: Gets or sets the nic ip addresses. :vartype ip_addresses: list[str] :ivar cloud: Cloud inventory resource details where the VM is present. @@ -2538,6 +2615,7 @@ class VirtualMachineInventoryItem(InventoryItemProperties): # pylint: disable=t "os_name": {"readonly": True}, "os_version": {"readonly": True}, "power_state": {"readonly": True}, + "generation": {"readonly": True}, "bios_guid": {"readonly": True}, "managed_machine_resource_id": {"readonly": True}, } @@ -2552,6 +2630,7 @@ class VirtualMachineInventoryItem(InventoryItemProperties): # pylint: disable=t "os_name": {"key": "osName", "type": "str"}, "os_version": {"key": "osVersion", "type": "str"}, "power_state": {"key": "powerState", "type": "str"}, + "generation": {"key": "generation", "type": "int"}, "ip_addresses": {"key": "ipAddresses", "type": "[str]"}, "cloud": {"key": "cloud", "type": "InventoryItemDetails"}, "bios_guid": {"key": "biosGuid", "type": "str"}, @@ -2573,14 +2652,15 @@ def __init__( """ super().__init__(**kwargs) self.inventory_type: str = "VirtualMachine" - self.os_type = None - self.os_name = None - self.os_version = None - self.power_state = None + self.os_type: Optional[Union[str, "_models.OsType"]] = None + self.os_name: Optional[str] = None + self.os_version: Optional[str] = None + self.power_state: Optional[str] = None + self.generation: Optional[int] = None self.ip_addresses = ip_addresses self.cloud = cloud - self.bios_guid = None - self.managed_machine_resource_id = None + self.bios_guid: Optional[str] = None + self.managed_machine_resource_id: Optional[str] = None class VirtualMachineRestoreCheckpoint(_serialization.Model): @@ -2611,7 +2691,7 @@ class VirtualMachineTemplate(TrackedResource): All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -2733,10 +2813,10 @@ def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.inventory_type: str = "VirtualMachineTemplate" - self.cpu_count = None - self.memory_mb = None - self.os_type = None - self.os_name = None + self.cpu_count: Optional[int] = None + self.memory_mb: Optional[int] = None + self.os_type: Optional[Union[str, "_models.OsType"]] = None + self.os_name: Optional[str] = None class VirtualMachineTemplateListResult(_serialization.Model): @@ -2769,10 +2849,10 @@ def __init__(self, *, value: List["_models.VirtualMachineTemplate"], **kwargs: A """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None -class VirtualMachineTemplateProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes +class VirtualMachineTemplateProperties(_serialization.Model): """Defines the resource properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -2880,21 +2960,21 @@ def __init__( self.inventory_item_id = inventory_item_id self.uuid = uuid self.vmm_server_id = vmm_server_id - self.os_type = None - self.os_name = None - self.computer_name = None - self.memory_mb = None - self.cpu_count = None - self.limit_cpu_for_migration = None - self.dynamic_memory_enabled = None - self.is_customizable = None - self.dynamic_memory_max_mb = None - self.dynamic_memory_min_mb = None - self.is_highly_available = None - self.generation = None - self.network_interfaces = None - self.disks = None - self.provisioning_state = None + self.os_type: Optional[Union[str, "_models.OsType"]] = None + self.os_name: Optional[str] = None + self.computer_name: Optional[str] = None + self.memory_mb: Optional[int] = None + self.cpu_count: Optional[int] = None + self.limit_cpu_for_migration: Optional[Union[str, "_models.LimitCpuForMigration"]] = None + self.dynamic_memory_enabled: Optional[Union[str, "_models.DynamicMemoryEnabled"]] = None + self.is_customizable: Optional[Union[str, "_models.IsCustomizable"]] = None + self.dynamic_memory_max_mb: Optional[int] = None + self.dynamic_memory_min_mb: Optional[int] = None + self.is_highly_available: Optional[Union[str, "_models.IsHighlyAvailable"]] = None + self.generation: Optional[int] = None + self.network_interfaces: Optional[List["_models.NetworkInterface"]] = None + self.disks: Optional[List["_models.VirtualDisk"]] = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None class VirtualMachineTemplateTagsUpdate(_serialization.Model): @@ -2925,7 +3005,7 @@ class VirtualNetwork(TrackedResource): All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -3063,7 +3143,7 @@ def __init__(self, *, value: List["_models.VirtualNetwork"], **kwargs: Any) -> N """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class VirtualNetworkProperties(_serialization.Model): @@ -3118,8 +3198,8 @@ def __init__( self.inventory_item_id = inventory_item_id self.uuid = uuid self.vmm_server_id = vmm_server_id - self.network_name = None - self.provisioning_state = None + self.network_name: Optional[str] = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None class VirtualNetworkTagsUpdate(_serialization.Model): @@ -3148,7 +3228,7 @@ class VmInstanceHybridIdentityMetadata(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -3218,7 +3298,7 @@ def __init__(self, *, value: List["_models.VmInstanceHybridIdentityMetadata"], * """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class VmInstanceHybridIdentityMetadataProperties(_serialization.Model): # pylint: disable=name-too-long @@ -3255,7 +3335,7 @@ def __init__(self, *, resource_uid: Optional[str] = None, public_key: Optional[s super().__init__(**kwargs) self.resource_uid = resource_uid self.public_key = public_key - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None class VmmCredential(_serialization.Model): @@ -3292,7 +3372,7 @@ class VmmServer(TrackedResource): All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -3386,7 +3466,7 @@ def __init__(self, *, value: List["_models.VmmServer"], **kwargs: Any) -> None: """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class VmmServerProperties(_serialization.Model): @@ -3456,11 +3536,11 @@ def __init__( self.credentials = credentials self.fqdn = fqdn self.port = port - self.connection_status = None - self.error_message = None - self.uuid = None - self.version = None - self.provisioning_state = None + self.connection_status: Optional[str] = None + self.error_message: Optional[str] = None + self.uuid: Optional[str] = None + self.version: Optional[str] = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None class VmmServerTagsUpdate(_serialization.Model): diff --git a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/__init__.py b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/__init__.py index b8f71f095a0c..d5261231a533 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/__init__.py +++ b/sdk/scvmm/azure-mgmt-scvmm/azure/mgmt/scvmm/operations/__init__.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,20 +6,26 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._virtual_machine_instances_operations import VirtualMachineInstancesOperations -from ._guest_agents_operations import GuestAgentsOperations -from ._vm_instance_hybrid_identity_metadatas_operations import VmInstanceHybridIdentityMetadatasOperations -from ._operations import Operations -from ._availability_sets_operations import AvailabilitySetsOperations -from ._clouds_operations import CloudsOperations -from ._virtual_machine_templates_operations import VirtualMachineTemplatesOperations -from ._virtual_networks_operations import VirtualNetworksOperations -from ._vmm_servers_operations import VmmServersOperations -from ._inventory_items_operations import InventoryItemsOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._virtual_machine_instances_operations import VirtualMachineInstancesOperations # type: ignore +from ._guest_agents_operations import GuestAgentsOperations # type: ignore +from ._vm_instance_hybrid_identity_metadatas_operations import VmInstanceHybridIdentityMetadatasOperations # type: ignore +from ._operations import Operations # type: ignore +from ._availability_sets_operations import AvailabilitySetsOperations # type: ignore +from ._clouds_operations import CloudsOperations # type: ignore +from ._virtual_machine_templates_operations import VirtualMachineTemplatesOperations # type: ignore +from ._virtual_networks_operations import VirtualNetworksOperations # type: ignore +from ._vmm_servers_operations import VmmServersOperations # type: ignore +from ._inventory_items_operations import InventoryItemsOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -33,5 +40,5 @@ "VmmServersOperations", "InventoryItemsOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() 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..e25448ff164b 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,37 +6,35 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping 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, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, 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 from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request +from .._configuration import ScVmmMgmtClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +46,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", "2025-03-13")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,14 +70,14 @@ 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", "2025-03-13")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -104,14 +102,14 @@ 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", "2025-03-13")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetResourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -144,7 +142,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", "2025-03-13")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -152,7 +150,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetResourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -187,7 +185,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", "2025-03-13")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -195,7 +193,7 @@ def build_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetResourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -235,14 +233,14 @@ 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", "2025-03-13")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetResourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -285,10 +283,10 @@ class AvailabilitySetsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ScVmmMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.AvailabilitySet"]: @@ -306,7 +304,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.AvailabilityS api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailabilitySetListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -323,7 +321,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 +336,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 @@ -388,7 +384,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AvailabilitySetListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -406,7 +402,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 +417,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 +463,7 @@ def get( :rtype: ~azure.mgmt.scvmm.models.AvailabilitySet :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -491,7 +485,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -506,7 +499,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,8 +512,8 @@ def _create_or_update_initial( availability_set_resource_name: str, resource: Union[_models.AvailabilitySet, IO[bytes]], **kwargs: Any - ) -> _models.AvailabilitySet: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -533,7 +526,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 +547,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 +558,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 +686,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,8 +720,8 @@ def _update_initial( availability_set_resource_name: str, properties: Union[_models.AvailabilitySetTagsUpdate, IO[bytes]], **kwargs: Any - ) -> Optional[_models.AvailabilitySet]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -739,7 +734,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 +755,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 +766,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 +892,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,14 +920,14 @@ 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: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -941,7 +939,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 +950,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 +961,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 +977,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 +1017,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 +1027,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..4cf8bdab08b6 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,37 +6,35 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping 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, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, 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 from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request +from .._configuration import ScVmmMgmtClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +46,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", "2025-03-13")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,14 +70,14 @@ 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", "2025-03-13")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -104,14 +102,14 @@ 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", "2025-03-13")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudResourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -139,7 +137,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", "2025-03-13")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -147,7 +145,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudResourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -177,7 +175,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", "2025-03-13")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -185,7 +183,7 @@ def build_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudResourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -220,14 +218,14 @@ 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", "2025-03-13")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudResourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -265,10 +263,10 @@ class CloudsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ScVmmMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Cloud"]: @@ -286,7 +284,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Cloud"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CloudListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -303,7 +301,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 +316,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 @@ -368,7 +364,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CloudListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -386,7 +382,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 +397,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -447,7 +441,7 @@ def get(self, resource_group_name: str, cloud_resource_name: str, **kwargs: Any) :rtype: ~azure.mgmt.scvmm.models.Cloud :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -469,7 +463,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 +477,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,8 +490,8 @@ def _create_or_update_initial( cloud_resource_name: str, resource: Union[_models.Cloud, IO[bytes]], **kwargs: Any - ) -> _models.Cloud: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -511,7 +504,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 +525,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 +536,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 +658,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,8 +692,8 @@ def _update_initial( cloud_resource_name: str, properties: Union[_models.CloudTagsUpdate, IO[bytes]], **kwargs: Any - ) -> Optional[_models.Cloud]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -711,7 +706,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 +727,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 +738,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 +861,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,14 +889,14 @@ 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: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -910,7 +908,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 +919,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 +930,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 +943,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 +983,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 +993,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..3cd2de34d769 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,37 +5,35 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping 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, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, 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 from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request +from .._configuration import ScVmmMgmtClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +47,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", "2025-03-13")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -76,13 +73,13 @@ 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", "2025-03-13")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/guestAgents/default" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } @@ -102,14 +99,14 @@ 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", "2025-03-13")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/guestAgents/default" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } @@ -131,13 +128,13 @@ 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", "2025-03-13")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/guestAgents/default" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } @@ -167,10 +164,10 @@ class GuestAgentsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ScVmmMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_virtual_machine_instance(self, resource_uri: str, **kwargs: Any) -> Iterable["_models.GuestAgent"]: @@ -191,7 +188,7 @@ def list_by_virtual_machine_instance(self, resource_uri: str, **kwargs: Any) -> api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GuestAgentListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -208,7 +205,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 +220,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 +262,7 @@ def get(self, resource_uri: str, **kwargs: Any) -> _models.GuestAgent: :rtype: ~azure.mgmt.scvmm.models.GuestAgent :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -287,7 +282,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 +296,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,8 +305,8 @@ 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: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -325,7 +319,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 +338,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 +349,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 +448,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 @@ -493,7 +489,7 @@ def delete(self, resource_uri: str, **kwargs: Any) -> None: # pylint: disable=i :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -513,7 +509,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..15e441132e85 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -21,20 +22,15 @@ ) 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 +from .._configuration import ScVmmMgmtClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,14 +44,14 @@ 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", "2025-03-13")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}/inventoryItems", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -87,14 +83,14 @@ 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", "2025-03-13")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}/inventoryItems/{inventoryItemResourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -132,7 +128,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", "2025-03-13")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -140,7 +136,7 @@ def build_create_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}/inventoryItems/{inventoryItemResourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -180,14 +176,14 @@ 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", "2025-03-13")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}/inventoryItems/{inventoryItemResourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -229,10 +225,10 @@ class InventoryItemsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ScVmmMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_vmm_server( @@ -257,7 +253,7 @@ def list_by_vmm_server( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.InventoryItemListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -276,7 +272,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -292,7 +287,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -341,7 +335,7 @@ def get( :rtype: ~azure.mgmt.scvmm.models.InventoryItem :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -364,7 +358,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -379,7 +372,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 @@ -477,7 +470,7 @@ def create( :rtype: ~azure.mgmt.scvmm.models.InventoryItem :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -512,7 +505,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -527,11 +519,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 @@ -557,7 +545,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -580,7 +568,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..90df6f244471 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -20,20 +20,15 @@ ) 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 +from .._configuration import ScVmmMgmtClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,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", "2025-03-13")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -74,10 +69,10 @@ class Operations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ScVmmMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -93,7 +88,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,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: @@ -125,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 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..3c8604b29d99 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,37 +6,35 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping 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, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, 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 from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request +from .._configuration import ScVmmMgmtClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +46,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", "2025-03-13")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +70,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", "2025-03-13")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -96,7 +94,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", "2025-03-13")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -123,7 +121,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", "2025-03-13")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -156,7 +154,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", "2025-03-13")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -184,14 +182,14 @@ 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", "2025-03-13")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/createCheckpoint" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } @@ -213,14 +211,14 @@ 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", "2025-03-13")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/deleteCheckpoint" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } @@ -242,7 +240,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", "2025-03-13")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -268,14 +266,14 @@ 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", "2025-03-13")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/restoreCheckpoint" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } @@ -297,7 +295,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", "2025-03-13")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -321,7 +319,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", "2025-03-13")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -358,10 +356,10 @@ class VirtualMachineInstancesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ScVmmMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list(self, resource_uri: str, **kwargs: Any) -> Iterable["_models.VirtualMachineInstance"]: @@ -383,7 +381,7 @@ def list(self, resource_uri: str, **kwargs: Any) -> Iterable["_models.VirtualMac api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachineInstanceListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -400,7 +398,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -416,7 +413,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -459,7 +455,7 @@ def get(self, resource_uri: str, **kwargs: Any) -> _models.VirtualMachineInstanc :rtype: ~azure.mgmt.scvmm.models.VirtualMachineInstance :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -479,7 +475,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 +489,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,8 +498,8 @@ 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: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -517,7 +512,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 +531,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 +542,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 +652,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,8 +682,8 @@ 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]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -699,7 +696,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 +715,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 +726,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 +834,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,14 +862,14 @@ 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: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -881,7 +881,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 +891,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 +902,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 +915,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 +956,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 +966,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,10 +990,10 @@ 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: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -997,7 +1006,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 +1025,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 +1036,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 +1048,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 +1130,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 +1140,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,10 +1164,10 @@ 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: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1162,7 +1180,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 +1199,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 +1210,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 +1222,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 +1304,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 +1314,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,10 +1338,8 @@ 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: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + def _restart_initial(self, resource_uri: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1326,7 +1351,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 +1359,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 +1370,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 +1382,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 +1411,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 +1419,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,10 +1443,10 @@ 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: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1425,7 +1459,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 +1478,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 +1489,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 +1501,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 +1583,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 +1593,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,10 +1617,8 @@ 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: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + def _start_initial(self, resource_uri: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1589,7 +1630,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 +1638,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 +1649,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 +1661,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 +1690,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 +1698,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,10 +1722,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - def _stop_initial( # pylint: disable=inconsistent-return-statements - self, resource_uri: str, body: Union[_models.StopVirtualMachineOptions, IO[bytes]], **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + def _stop_initial( + self, + resource_uri: str, + body: Optional[Union[_models.StopVirtualMachineOptions, IO[bytes]]] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1688,7 +1741,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 +1749,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 +1763,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 +1774,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 +1786,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 +1809,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 +1821,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 +1835,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 +1847,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 +1860,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 +1876,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 +1886,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..7b709cf59e92 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,37 +6,35 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping 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, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, 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 from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request +from .._configuration import ScVmmMgmtClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +46,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", "2025-03-13")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -74,14 +72,14 @@ 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", "2025-03-13")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachineTemplates", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -106,14 +104,14 @@ 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", "2025-03-13")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachineTemplates/{virtualMachineTemplateName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -146,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", "2025-03-13")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -154,7 +152,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachineTemplates/{virtualMachineTemplateName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -189,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", "2025-03-13")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -197,7 +195,7 @@ def build_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachineTemplates/{virtualMachineTemplateName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -237,14 +235,14 @@ 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", "2025-03-13")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachineTemplates/{virtualMachineTemplateName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -287,10 +285,10 @@ class VirtualMachineTemplatesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ScVmmMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.VirtualMachineTemplate"]: @@ -309,7 +307,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.VirtualMachin api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachineTemplateListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -326,7 +324,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 +339,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 @@ -394,7 +390,7 @@ def list_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachineTemplateListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -412,7 +408,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 +423,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 @@ -475,7 +469,7 @@ def get( :rtype: ~azure.mgmt.scvmm.models.VirtualMachineTemplate :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -497,7 +491,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -512,7 +505,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,8 +518,8 @@ def _create_or_update_initial( virtual_machine_template_name: str, resource: Union[_models.VirtualMachineTemplate, IO[bytes]], **kwargs: Any - ) -> _models.VirtualMachineTemplate: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -539,7 +532,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 +553,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 +564,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 +689,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,8 +723,8 @@ def _update_initial( virtual_machine_template_name: str, properties: Union[_models.VirtualMachineTemplateTagsUpdate, IO[bytes]], **kwargs: Any - ) -> Optional[_models.VirtualMachineTemplate]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -742,7 +737,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 +758,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 +769,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 +895,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,14 +923,14 @@ 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: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -944,7 +942,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 +953,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 +964,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 +977,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 +1017,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 +1027,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..8ca003f07f09 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,37 +6,35 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping 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, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, 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 from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request +from .._configuration import ScVmmMgmtClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +46,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", "2025-03-13")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,14 +70,14 @@ 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", "2025-03-13")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualNetworks", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -104,14 +102,14 @@ 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", "2025-03-13")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualNetworks/{virtualNetworkName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -139,7 +137,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", "2025-03-13")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -147,7 +145,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualNetworks/{virtualNetworkName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -177,7 +175,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", "2025-03-13")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -185,7 +183,7 @@ def build_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualNetworks/{virtualNetworkName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -220,14 +218,14 @@ 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", "2025-03-13")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualNetworks/{virtualNetworkName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -265,10 +263,10 @@ class VirtualNetworksOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ScVmmMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.VirtualNetwork"]: @@ -286,7 +284,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.VirtualNetwor api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualNetworkListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -303,7 +301,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 +316,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 @@ -368,7 +364,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualNetworkListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -386,7 +382,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 +397,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -447,7 +441,7 @@ def get(self, resource_group_name: str, virtual_network_name: str, **kwargs: Any :rtype: ~azure.mgmt.scvmm.models.VirtualNetwork :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -469,7 +463,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 +477,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,8 +490,8 @@ def _create_or_update_initial( virtual_network_name: str, resource: Union[_models.VirtualNetwork, IO[bytes]], **kwargs: Any - ) -> _models.VirtualNetwork: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -511,7 +504,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 +525,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 +536,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 +661,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,8 +695,8 @@ def _update_initial( virtual_network_name: str, properties: Union[_models.VirtualNetworkTagsUpdate, IO[bytes]], **kwargs: Any - ) -> Optional[_models.VirtualNetwork]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -714,7 +709,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 +730,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 +741,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 +867,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,14 +895,14 @@ 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: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -916,7 +914,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 +925,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 +936,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 +949,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 +989,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 +999,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..90c1e0a90f88 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -20,20 +20,15 @@ ) 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 +from .._configuration import ScVmmMgmtClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,14 +42,14 @@ 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", "2025-03-13")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/hybridIdentityMetadata", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } @@ -74,14 +69,14 @@ 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", "2025-03-13")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/hybridIdentityMetadata/default", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } @@ -111,10 +106,10 @@ class VmInstanceHybridIdentityMetadatasOperations: # pylint: disable=name-too-l def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ScVmmMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_virtual_machine_instance( @@ -138,7 +133,7 @@ def list_by_virtual_machine_instance( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VmInstanceHybridIdentityMetadataListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -155,7 +150,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -171,7 +165,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -214,7 +207,7 @@ def get(self, resource_uri: str, **kwargs: Any) -> _models.VmInstanceHybridIdent :rtype: ~azure.mgmt.scvmm.models.VmInstanceHybridIdentityMetadata :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -234,7 +227,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 +241,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..4b8a5c927038 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,37 +6,35 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping 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, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, 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 from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request +from .._configuration import ScVmmMgmtClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +46,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", "2025-03-13")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,14 +70,14 @@ 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", "2025-03-13")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -104,14 +102,14 @@ 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", "2025-03-13")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -139,7 +137,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", "2025-03-13")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -147,7 +145,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -177,7 +175,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", "2025-03-13")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -185,7 +183,7 @@ def build_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -220,14 +218,14 @@ 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", "2025-03-13")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -265,10 +263,10 @@ class VmmServersOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ScVmmMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.VmmServer"]: @@ -286,7 +284,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.VmmServer"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VmmServerListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -303,7 +301,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 +316,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 @@ -368,7 +364,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VmmServerListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -386,7 +382,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 +397,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -447,7 +441,7 @@ def get(self, resource_group_name: str, vmm_server_name: str, **kwargs: Any) -> :rtype: ~azure.mgmt.scvmm.models.VmmServer :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -469,7 +463,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 +477,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,8 +490,8 @@ def _create_or_update_initial( vmm_server_name: str, resource: Union[_models.VmmServer, IO[bytes]], **kwargs: Any - ) -> _models.VmmServer: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -511,7 +504,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 +525,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 +536,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 +658,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,8 +692,8 @@ def _update_initial( vmm_server_name: str, properties: Union[_models.VmmServerTagsUpdate, IO[bytes]], **kwargs: Any - ) -> Optional[_models.VmmServer]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -711,7 +706,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 +727,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 +738,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 +861,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,14 +889,14 @@ 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: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -910,7 +908,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 +919,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 +930,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 +943,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 +983,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 +993,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..9cf5a0bfaa7c 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,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 +50,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/2025-03-13/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..9e9557a8134d 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,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 +39,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/2025-03-13/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..ea597e0a2425 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -36,6 +37,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/2025-03-13/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..c832fd7c577e 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -36,6 +37,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/2025-03-13/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..4bd4239d8d72 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,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/2025-03-13/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..581c5e95dfcb 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,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/2025-03-13/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..54fd184c8944 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,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/2025-03-13/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..58116f0ac68f 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,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/2025-03-13/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..b6d1e23334f4 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,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/2025-03-13/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..de836aacd8f8 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,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/2025-03-13/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..4a0a5ac2cb0f 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,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 +39,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/2025-03-13/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..f8f2f5506cf4 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,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 +52,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/2025-03-13/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..ee2ce1e7ffbc 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,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 +39,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/2025-03-13/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..168217d6f7c2 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -36,6 +37,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/2025-03-13/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..9e6a4565edd6 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -36,6 +37,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/2025-03-13/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..c64a7af1f7ac 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,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/2025-03-13/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..86a7bd6b3b13 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,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/2025-03-13/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..13bc339ff94e 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,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/2025-03-13/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..b1074c59160c 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,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/2025-03-13/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..1a495b66253f 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,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/2025-03-13/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..24e4ee6343bb 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,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/2025-03-13/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..efbcaf5570b5 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,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 +39,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/2025-03-13/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..7904dc13e687 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,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 +44,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/2025-03-13/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..83ad073fa67e 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,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/2025-03-13/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..ba2fbcf4bc6d 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,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/2025-03-13/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..b1bb76a04f04 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -36,6 +37,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/2025-03-13/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..47c457c104a3 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -36,6 +37,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/2025-03-13/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..6e5995faef7c 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,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/2025-03-13/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..f29731d9a4a0 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,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/2025-03-13/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..d90200fb1e58 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,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 +40,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/2025-03-13/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..26843baf5b93 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,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/2025-03-13/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..fe479e2ebfbe 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,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/2025-03-13/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..cd0c5dab6359 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2025-03-13/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..960f10547c4b 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2025-03-13/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..3a1d5e8e1413 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2025-03-13/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..f145a4340131 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,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/2025-03-13/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..02c9a11a7ba8 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,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/2025-03-13/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..d80ccf0fa3c8 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,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/2025-03-13/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..f0913430bd91 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,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 +37,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/2025-03-13/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..c2db191a06ad 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,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 @@ -87,8 +86,16 @@ def main(): }, "osProfile": { "adminPassword": "vavtppmmhlspydtkzxda", + "adminUsername": "asasas", "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 +119,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/2025-03-13/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..a1f9742f0813 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,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 +38,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/2025-03-13/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..3ab6483e5c6b 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,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 +37,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/2025-03-13/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..e599a7433375 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,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/2025-03-13/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..d85ca9fbc05d 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,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/2025-03-13/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..ea8b41b00d1a 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -36,6 +37,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/2025-03-13/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..9ffd6f6f2e54 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -36,6 +37,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/2025-03-13/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..2f721edc0f04 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,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/2025-03-13/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..05bc618437da 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,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/2025-03-13/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..79369757d035 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,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/2025-03-13/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..c49bc76eeffa 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,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/2025-03-13/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..49e61247caf5 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,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 +37,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/2025-03-13/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..282340e69998 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,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/2025-03-13/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..da7273ab3bc5 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,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/2025-03-13/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..39c8fb834a5f 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,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 +33,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/2025-03-13/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..73cba1747e59 --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_samples/virtual_machine_instances_stop_minimum_set_gen.py @@ -0,0 +1,41 @@ +# pylint: disable=line-too-long,useless-suppression +# 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/2025-03-13/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..0b7efb5f1258 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,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 +83,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/2025-03-13/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..006f54c92f2e 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,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 +56,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/2025-03-13/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..905bb9081d3b 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,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 +39,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/2025-03-13/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..f5404861366f 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -36,6 +37,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/2025-03-13/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..309b892e3df8 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -36,6 +37,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/2025-03-13/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..b847e9073881 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,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/2025-03-13/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..52094ff1d7a9 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,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/2025-03-13/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..87b6b883323a 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,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/2025-03-13/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..f11c20cbcebb 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,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/2025-03-13/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..84cbe1be1d8f 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,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/2025-03-13/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..347a4a2a8ba9 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,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/2025-03-13/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..0388560180e6 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,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 +39,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/2025-03-13/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..636304389c28 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,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 +51,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/2025-03-13/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..bccd7a2b6a75 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,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 +39,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/2025-03-13/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..261f70d2c7a2 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -36,6 +37,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/2025-03-13/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..e1fe0af3812e 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -36,6 +37,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/2025-03-13/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..ee70418eebcd 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,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/2025-03-13/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..f421ebc96562 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,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/2025-03-13/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..66407fdd9874 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,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/2025-03-13/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..9d9dda15747d 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,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/2025-03-13/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..b0b053d03ed8 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,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/2025-03-13/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..cf8587278277 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,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/2025-03-13/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..7c5b413eb290 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,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 +39,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/2025-03-13/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..96089089c899 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -36,6 +37,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/2025-03-13/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..8f90ded0330c 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -36,6 +37,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/2025-03-13/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..2dde339cb396 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,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/2025-03-13/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..44ca7ae25430 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,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/2025-03-13/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..e103076277f2 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,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 +51,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/2025-03-13/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..b1167d26defc 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,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 +39,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/2025-03-13/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..32c6396452e2 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -36,6 +37,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/2025-03-13/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..5c21e26a4939 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -36,6 +37,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/2025-03-13/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..021c2eda7b3b 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,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/2025-03-13/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..ab0616a8f4c5 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,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/2025-03-13/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..e55c549f3bba 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,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/2025-03-13/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..42e9a2519d0e 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,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/2025-03-13/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..f62a2596811e 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,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/2025-03-13/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..b3eb8773b08a 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,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/2025-03-13/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..cc70d3b58a43 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,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 +39,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/2025-03-13/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..12f994e4f344 --- /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() + + +# For security, please avoid 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..7058ead868e6 --- /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_availability_sets_list_by_subscription(self, resource_group): + response = self.client.availability_sets.list_by_subscription( + api_version="2025-03-13", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_availability_sets_list_by_resource_group(self, resource_group): + response = self.client.availability_sets.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2025-03-13", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_availability_sets_get(self, resource_group): + response = self.client.availability_sets.get( + resource_group_name=resource_group.name, + availability_set_resource_name="str", + api_version="2025-03-13", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_availability_sets_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="2025-03-13", + ).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_availability_sets_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="2025-03-13", + ).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_availability_sets_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="2025-03-13", + ).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..9dbda2e71910 --- /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_availability_sets_list_by_subscription(self, resource_group): + response = self.client.availability_sets.list_by_subscription( + api_version="2025-03-13", + ) + 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_availability_sets_list_by_resource_group(self, resource_group): + response = self.client.availability_sets.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2025-03-13", + ) + 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_availability_sets_get(self, resource_group): + response = await self.client.availability_sets.get( + resource_group_name=resource_group.name, + availability_set_resource_name="str", + api_version="2025-03-13", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_availability_sets_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="2025-03-13", + ) + ).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_availability_sets_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="2025-03-13", + ) + ).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_availability_sets_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="2025-03-13", + ) + ).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..e720d98d45ea --- /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_clouds_list_by_subscription(self, resource_group): + response = self.client.clouds.list_by_subscription( + api_version="2025-03-13", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_clouds_list_by_resource_group(self, resource_group): + response = self.client.clouds.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2025-03-13", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_clouds_get(self, resource_group): + response = self.client.clouds.get( + resource_group_name=resource_group.name, + cloud_resource_name="str", + api_version="2025-03-13", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_clouds_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, "storageGB": 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="2025-03-13", + ).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_clouds_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="2025-03-13", + ).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_clouds_begin_delete(self, resource_group): + response = self.client.clouds.begin_delete( + resource_group_name=resource_group.name, + cloud_resource_name="str", + api_version="2025-03-13", + ).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..980bf14058c8 --- /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_clouds_list_by_subscription(self, resource_group): + response = self.client.clouds.list_by_subscription( + api_version="2025-03-13", + ) + 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_clouds_list_by_resource_group(self, resource_group): + response = self.client.clouds.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2025-03-13", + ) + 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_clouds_get(self, resource_group): + response = await self.client.clouds.get( + resource_group_name=resource_group.name, + cloud_resource_name="str", + api_version="2025-03-13", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_clouds_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, "storageGB": 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="2025-03-13", + ) + ).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_clouds_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="2025-03-13", + ) + ).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_clouds_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="2025-03-13", + ) + ).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..73ac6a9253e4 --- /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_guest_agents_list_by_virtual_machine_instance(self, resource_group): + response = self.client.guest_agents.list_by_virtual_machine_instance( + resource_uri="str", + api_version="2025-03-13", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_guest_agents_get(self, resource_group): + response = self.client.guest_agents.get( + resource_uri="str", + api_version="2025-03-13", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_guest_agents_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="2025-03-13", + ).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_guest_agents_delete(self, resource_group): + response = self.client.guest_agents.delete( + resource_uri="str", + api_version="2025-03-13", + ) + + # 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..94a6c92e153b --- /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_guest_agents_list_by_virtual_machine_instance(self, resource_group): + response = self.client.guest_agents.list_by_virtual_machine_instance( + resource_uri="str", + api_version="2025-03-13", + ) + 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_guest_agents_get(self, resource_group): + response = await self.client.guest_agents.get( + resource_uri="str", + api_version="2025-03-13", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_guest_agents_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="2025-03-13", + ) + ).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_guest_agents_delete(self, resource_group): + response = await self.client.guest_agents.delete( + resource_uri="str", + api_version="2025-03-13", + ) + + # 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..9db43e73fc4b --- /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_inventory_items_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="2025-03-13", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_inventory_items_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="2025-03-13", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_inventory_items_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="2025-03-13", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_inventory_items_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="2025-03-13", + ) + + # 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..bcbb9d5fbb4f --- /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_inventory_items_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="2025-03-13", + ) + 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_inventory_items_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="2025-03-13", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_inventory_items_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="2025-03-13", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_inventory_items_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="2025-03-13", + ) + + # 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..46c1e4f26eb8 --- /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_operations_list(self, resource_group): + response = self.client.operations.list( + api_version="2025-03-13", + ) + 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..3cea3c32108e --- /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_operations_list(self, resource_group): + response = self.client.operations.list( + api_version="2025-03-13", + ) + 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..40689c0887f1 --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_virtual_machine_instances_operations.py @@ -0,0 +1,284 @@ +# 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_virtual_machine_instances_list(self, resource_group): + response = self.client.virtual_machine_instances.list( + resource_uri="str", + api_version="2025-03-13", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_instances_get(self, resource_group): + response = self.client.virtual_machine_instances.get( + resource_uri="str", + api_version="2025-03-13", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_instances_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", + "adminUsername": "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="2025-03-13", + ).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_virtual_machine_instances_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="2025-03-13", + ).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_virtual_machine_instances_begin_delete(self, resource_group): + response = self.client.virtual_machine_instances.begin_delete( + resource_uri="str", + api_version="2025-03-13", + ).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_virtual_machine_instances_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="2025-03-13", + ).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_virtual_machine_instances_begin_delete_checkpoint(self, resource_group): + response = self.client.virtual_machine_instances.begin_delete_checkpoint( + resource_uri="str", + body={"id": "str"}, + api_version="2025-03-13", + ).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_virtual_machine_instances_begin_restart(self, resource_group): + response = self.client.virtual_machine_instances.begin_restart( + resource_uri="str", + api_version="2025-03-13", + ).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_virtual_machine_instances_begin_restore_checkpoint(self, resource_group): + response = self.client.virtual_machine_instances.begin_restore_checkpoint( + resource_uri="str", + body={"id": "str"}, + api_version="2025-03-13", + ).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_virtual_machine_instances_begin_start(self, resource_group): + response = self.client.virtual_machine_instances.begin_start( + resource_uri="str", + api_version="2025-03-13", + ).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_virtual_machine_instances_begin_stop(self, resource_group): + response = self.client.virtual_machine_instances.begin_stop( + resource_uri="str", + api_version="2025-03-13", + ).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..dddaa040480f --- /dev/null +++ b/sdk/scvmm/azure-mgmt-scvmm/generated_tests/test_sc_vmm_mgmt_virtual_machine_instances_operations_async.py @@ -0,0 +1,308 @@ +# 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_virtual_machine_instances_list(self, resource_group): + response = self.client.virtual_machine_instances.list( + resource_uri="str", + api_version="2025-03-13", + ) + 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_virtual_machine_instances_get(self, resource_group): + response = await self.client.virtual_machine_instances.get( + resource_uri="str", + api_version="2025-03-13", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_instances_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", + "adminUsername": "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="2025-03-13", + ) + ).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_virtual_machine_instances_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="2025-03-13", + ) + ).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_virtual_machine_instances_begin_delete(self, resource_group): + response = await ( + await self.client.virtual_machine_instances.begin_delete( + resource_uri="str", + api_version="2025-03-13", + ) + ).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_virtual_machine_instances_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="2025-03-13", + ) + ).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_virtual_machine_instances_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="2025-03-13", + ) + ).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_virtual_machine_instances_begin_restart(self, resource_group): + response = await ( + await self.client.virtual_machine_instances.begin_restart( + resource_uri="str", + api_version="2025-03-13", + ) + ).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_virtual_machine_instances_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="2025-03-13", + ) + ).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_virtual_machine_instances_begin_start(self, resource_group): + response = await ( + await self.client.virtual_machine_instances.begin_start( + resource_uri="str", + api_version="2025-03-13", + ) + ).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_virtual_machine_instances_begin_stop(self, resource_group): + response = await ( + await self.client.virtual_machine_instances.begin_stop( + resource_uri="str", + api_version="2025-03-13", + ) + ).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..174ce97e426e --- /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_virtual_machine_templates_list_by_subscription(self, resource_group): + response = self.client.virtual_machine_templates.list_by_subscription( + api_version="2025-03-13", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_templates_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="2025-03-13", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_templates_get(self, resource_group): + response = self.client.virtual_machine_templates.get( + resource_group_name=resource_group.name, + virtual_machine_template_name="str", + api_version="2025-03-13", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_machine_templates_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="2025-03-13", + ).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_virtual_machine_templates_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="2025-03-13", + ).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_virtual_machine_templates_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="2025-03-13", + ).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..1c8046829ef1 --- /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_virtual_machine_templates_list_by_subscription(self, resource_group): + response = self.client.virtual_machine_templates.list_by_subscription( + api_version="2025-03-13", + ) + 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_virtual_machine_templates_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="2025-03-13", + ) + 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_virtual_machine_templates_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="2025-03-13", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_machine_templates_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="2025-03-13", + ) + ).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_virtual_machine_templates_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="2025-03-13", + ) + ).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_virtual_machine_templates_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="2025-03-13", + ) + ).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..f904f99932c7 --- /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_virtual_networks_list_by_subscription(self, resource_group): + response = self.client.virtual_networks.list_by_subscription( + api_version="2025-03-13", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_networks_list_by_resource_group(self, resource_group): + response = self.client.virtual_networks.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2025-03-13", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_networks_get(self, resource_group): + response = self.client.virtual_networks.get( + resource_group_name=resource_group.name, + virtual_network_name="str", + api_version="2025-03-13", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_virtual_networks_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="2025-03-13", + ).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_virtual_networks_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="2025-03-13", + ).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_virtual_networks_begin_delete(self, resource_group): + response = self.client.virtual_networks.begin_delete( + resource_group_name=resource_group.name, + virtual_network_name="str", + api_version="2025-03-13", + ).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..daa8539025fb --- /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_virtual_networks_list_by_subscription(self, resource_group): + response = self.client.virtual_networks.list_by_subscription( + api_version="2025-03-13", + ) + 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_virtual_networks_list_by_resource_group(self, resource_group): + response = self.client.virtual_networks.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2025-03-13", + ) + 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_virtual_networks_get(self, resource_group): + response = await self.client.virtual_networks.get( + resource_group_name=resource_group.name, + virtual_network_name="str", + api_version="2025-03-13", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_virtual_networks_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="2025-03-13", + ) + ).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_virtual_networks_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="2025-03-13", + ) + ).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_virtual_networks_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="2025-03-13", + ) + ).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..8c213af5ce70 --- /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_vm_instance_hybrid_identity_metadatas_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="2025-03-13", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_vm_instance_hybrid_identity_metadatas_get(self, resource_group): + response = self.client.vm_instance_hybrid_identity_metadatas.get( + resource_uri="str", + api_version="2025-03-13", + ) + + # 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..64e16439af60 --- /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_vm_instance_hybrid_identity_metadatas_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="2025-03-13", + ) + 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_vm_instance_hybrid_identity_metadatas_get(self, resource_group): + response = await self.client.vm_instance_hybrid_identity_metadatas.get( + resource_uri="str", + api_version="2025-03-13", + ) + + # 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..763bfa2af4cd --- /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_vmm_servers_list_by_subscription(self, resource_group): + response = self.client.vmm_servers.list_by_subscription( + api_version="2025-03-13", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_vmm_servers_list_by_resource_group(self, resource_group): + response = self.client.vmm_servers.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2025-03-13", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_vmm_servers_get(self, resource_group): + response = self.client.vmm_servers.get( + resource_group_name=resource_group.name, + vmm_server_name="str", + api_version="2025-03-13", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_vmm_servers_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="2025-03-13", + ).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_vmm_servers_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="2025-03-13", + ).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_vmm_servers_begin_delete(self, resource_group): + response = self.client.vmm_servers.begin_delete( + resource_group_name=resource_group.name, + vmm_server_name="str", + api_version="2025-03-13", + ).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..77efa20a501d --- /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_vmm_servers_list_by_subscription(self, resource_group): + response = self.client.vmm_servers.list_by_subscription( + api_version="2025-03-13", + ) + 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_vmm_servers_list_by_resource_group(self, resource_group): + response = self.client.vmm_servers.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2025-03-13", + ) + 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_vmm_servers_get(self, resource_group): + response = await self.client.vmm_servers.get( + resource_group_name=resource_group.name, + vmm_server_name="str", + api_version="2025-03-13", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_vmm_servers_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="2025-03-13", + ) + ).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_vmm_servers_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="2025-03-13", + ) + ).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_vmm_servers_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="2025-03-13", + ) + ).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..1a557bbb6b8b 100644 --- a/sdk/scvmm/azure-mgmt-scvmm/setup.py +++ b/sdk/scvmm/azure-mgmt-scvmm/setup.py @@ -53,7 +53,6 @@ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -75,8 +74,9 @@ }, install_requires=[ "isodate>=0.6.1", + "typing-extensions>=4.6.0", "azure-common>=1.1", - "azure-mgmt-core>=1.3.2", + "azure-mgmt-core>=1.5.0", ], - python_requires=">=3.8", + python_requires=">=3.9", )