From 2305e3de343dd67244ae34fb2664aecdd3e36163 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 18 Sep 2023 15:38:59 +0000 Subject: [PATCH] CodeGen from PR 25409 in Azure/azure-rest-api-specs Merge 5cb6705ce99cb118334113cf031b4e7bf48decb3 into def187e2e78d7173d8fdd7f77740dd9719e1dfbf --- .../azure-mgmt-connectedvmware/_meta.json | 10 +- ...azure_arc_vmware_management_service_api.py | 50 +- .../mgmt/connectedvmware/_configuration.py | 12 +- .../mgmt/connectedvmware/_serialization.py | 119 +- .../azure/mgmt/connectedvmware/_vendor.py | 31 - .../azure/mgmt/connectedvmware/_version.py | 2 +- ...azure_arc_vmware_management_service_api.py | 51 +- .../connectedvmware/aio/_configuration.py | 12 +- .../azure/mgmt/connectedvmware/aio/_vendor.py | 28 - .../aio/operations/__init__.py | 16 +- ...mware_management_service_api_operations.py | 259 -- .../aio/operations/_clusters_operations.py | 73 +- .../aio/operations/_datastores_operations.py | 73 +- .../aio/operations/_hosts_operations.py | 73 +- .../_hybrid_identity_metadata_operations.py | 456 ---- .../operations/_inventory_items_operations.py | 40 +- .../_machine_extensions_operations.py | 842 ------- .../aio/operations/_operations.py | 13 +- .../operations/_resource_pools_operations.py | 74 +- .../aio/operations/_vcenters_operations.py | 73 +- ... _virtual_machine_instances_operations.py} | 1180 +++------ .../_virtual_machine_templates_operations.py | 74 +- .../_virtual_networks_operations.py | 74 +- ...> _vm_instance_guest_agents_operations.py} | 193 +- ...nce_hybrid_identity_metadata_operations.py | 205 ++ .../mgmt/connectedvmware/models/__init__.py | 92 +- ...arc_vmware_management_service_api_enums.py | 101 - .../connectedvmware/models/_models_py3.py | 2193 +++++------------ .../connectedvmware/operations/__init__.py | 16 +- ...mware_management_service_api_operations.py | 297 --- .../operations/_clusters_operations.py | 110 +- .../operations/_datastores_operations.py | 110 +- .../operations/_hosts_operations.py | 110 +- .../_hybrid_identity_metadata_operations.py | 589 ----- .../operations/_inventory_items_operations.py | 65 +- .../_machine_extensions_operations.py | 1017 -------- .../connectedvmware/operations/_operations.py | 18 +- .../operations/_resource_pools_operations.py | 111 +- .../operations/_vcenters_operations.py | 110 +- .../_virtual_machine_instances_operations.py | 1423 +++++++++++ .../_virtual_machine_templates_operations.py | 111 +- .../_virtual_machines_operations.py | 2110 ---------------- .../_virtual_networks_operations.py | 111 +- ...> _vm_instance_guest_agents_operations.py} | 257 +- ...nce_hybrid_identity_metadata_operations.py | 261 ++ .../generated_samples/create_cluster.py | 2 +- .../generated_samples/create_datastore.py | 2 +- .../generated_samples/create_host.py | 2 +- .../create_hybrid_identity_metadata.py | 42 - .../create_inventory_item.py | 2 +- .../generated_samples/create_resource_pool.py | 2 +- .../generated_samples/create_vcenter.py | 2 +- .../create_virtual_machine_instance.py | 40 + .../create_virtual_machine_template.py | 2 +- .../create_virtual_network.py | 2 +- .../create_vm_instance_guest_agent.py | 40 + .../generated_samples/delete_cluster.py | 5 +- .../generated_samples/delete_datastore.py | 5 +- .../generated_samples/delete_host.py | 5 +- .../delete_inventory_item.py | 5 +- .../generated_samples/delete_resource_pool.py | 5 +- .../generated_samples/delete_vcenter.py | 5 +- .../delete_virtual_machine.py | 41 - ....py => delete_virtual_machine_instance.py} | 12 +- .../delete_virtual_machine_template.py | 5 +- .../delete_virtual_network.py | 5 +- ...t.py => delete_vm_instance_guest_agent.py} | 13 +- .../generated_samples/extensions_upgrade.py | 47 - .../generated_samples/get_cluster.py | 2 +- .../generated_samples/get_datastore.py | 2 +- .../generated_samples/get_guest_agent.py | 42 - .../generated_samples/get_host.py | 2 +- .../generated_samples/get_inventory_item.py | 2 +- .../generated_samples/get_resource_pool.py | 2 +- .../generated_samples/get_vcenter.py | 2 +- .../generated_samples/get_virtual_machine.py | 41 - ...ata.py => get_virtual_machine_instance.py} | 12 +- .../get_virtual_machine_template.py | 2 +- .../generated_samples/get_virtual_network.py | 2 +- ...sion.py => get_vm_instance_guest_agent.py} | 12 +- ...t_vm_instance_hybrid_identity_metadata.py} | 12 +- ..._identity_metadata_list_by_vm_instance.py} | 11 +- .../inventory_items_list_by_vcenter.py | 2 +- .../generated_samples/list_clusters.py | 2 +- .../list_clusters_by_resource_group.py | 2 +- .../generated_samples/list_datastores.py | 2 +- .../list_datastores_by_resource_group.py | 2 +- .../generated_samples/list_hosts.py | 2 +- .../list_hosts_by_resource_group.py | 2 +- .../generated_samples/list_operations.py | 2 +- .../generated_samples/list_resource_pools.py | 2 +- .../list_resource_pools_by_resource_group.py | 2 +- .../generated_samples/list_vcenters.py | 2 +- .../list_vcenters_by_resource_group.py | 2 +- ...m.py => list_virtual_machine_instances.py} | 11 +- .../list_virtual_machine_templates.py | 2 +- ...ual_machine_templates_by_resource_group.py | 2 +- .../list_virtual_machines.py | 39 - ...list_virtual_machines_by_resource_group.py | 41 - .../list_virtual_networks.py | 2 +- ...list_virtual_networks_by_resource_group.py | 2 +- .../generated_samples/put_extension.py | 51 - .../restart_virtual_machine.py | 41 - .../restart_virtual_machine_instance.py | 39 + .../start_virtual_machine.py | 41 - ...t.py => start_virtual_machine_instance.py} | 13 +- .../generated_samples/stop_virtual_machine.py | 41 - ...on.py => stop_virtual_machine_instance.py} | 13 +- .../generated_samples/update_cluster.py | 2 +- .../generated_samples/update_datastore.py | 2 +- .../generated_samples/update_extension.py | 50 - .../generated_samples/update_host.py | 2 +- .../generated_samples/update_resource_pool.py | 2 +- .../generated_samples/update_vcenter.py | 2 +- .../update_virtual_machine.py | 41 - .../update_virtual_machine_instance.py | 40 + .../update_virtual_machine_template.py | 2 +- .../update_virtual_network.py | 2 +- .../virtual_machine_assess_patches.py | 41 - .../virtual_machine_install_patches.py | 49 - ... => vm_instance_guest_agent_list_by_vm.py} | 11 +- 121 files changed, 3913 insertions(+), 10377 deletions(-) delete mode 100644 sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/_vendor.py delete mode 100644 sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_azure_arc_vmware_management_service_api_operations.py delete mode 100644 sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_hybrid_identity_metadata_operations.py delete mode 100644 sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_machine_extensions_operations.py rename sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/{_virtual_machines_operations.py => _virtual_machine_instances_operations.py} (51%) rename sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/{_guest_agents_operations.py => _vm_instance_guest_agents_operations.py} (74%) create mode 100644 sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_vm_instance_hybrid_identity_metadata_operations.py delete mode 100644 sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_azure_arc_vmware_management_service_api_operations.py delete mode 100644 sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_hybrid_identity_metadata_operations.py delete mode 100644 sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_machine_extensions_operations.py create mode 100644 sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_virtual_machine_instances_operations.py delete mode 100644 sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_virtual_machines_operations.py rename sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/{_guest_agents_operations.py => _vm_instance_guest_agents_operations.py} (68%) create mode 100644 sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_vm_instance_hybrid_identity_metadata_operations.py delete mode 100644 sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_hybrid_identity_metadata.py create mode 100644 sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_virtual_machine_instance.py create mode 100644 sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_vm_instance_guest_agent.py delete mode 100644 sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_virtual_machine.py rename sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/{create_virtual_machine.py => delete_virtual_machine_instance.py} (77%) rename sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/{create_guest_agent.py => delete_vm_instance_guest_agent.py} (77%) delete mode 100644 sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/extensions_upgrade.py delete mode 100644 sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_guest_agent.py delete mode 100644 sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_virtual_machine.py rename sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/{get_hybrid_identity_metadata.py => get_virtual_machine_instance.py} (77%) rename sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/{get_extension.py => get_vm_instance_guest_agent.py} (77%) rename sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/{delete_hybrid_identity_metadata.py => get_vm_instance_hybrid_identity_metadata.py} (75%) rename sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/{list_extension.py => hybrid_identity_metadata_list_by_vm_instance.py} (75%) rename sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/{guest_agent_list_by_vm.py => list_virtual_machine_instances.py} (77%) delete mode 100644 sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machines.py delete mode 100644 sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machines_by_resource_group.py delete mode 100644 sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/put_extension.py delete mode 100644 sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/restart_virtual_machine.py create mode 100644 sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/restart_virtual_machine_instance.py delete mode 100644 sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/start_virtual_machine.py rename sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/{delete_guest_agent.py => start_virtual_machine_instance.py} (77%) delete mode 100644 sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/stop_virtual_machine.py rename sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/{delete_extension.py => stop_virtual_machine_instance.py} (77%) delete mode 100644 sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_extension.py delete mode 100644 sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_virtual_machine.py create mode 100644 sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_virtual_machine_instance.py delete mode 100644 sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/virtual_machine_assess_patches.py delete mode 100644 sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/virtual_machine_install_patches.py rename sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/{hybrid_identity_metadata_list_by_vm.py => vm_instance_guest_agent_list_by_vm.py} (77%) diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/_meta.json b/sdk/connectedvmware/azure-mgmt-connectedvmware/_meta.json index 8639cba6d569..6347863c6f07 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/_meta.json +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/_meta.json @@ -1,11 +1,11 @@ { - "commit": "e37a57df67daaa82f9c3758fc450bc8655812a08", + "commit": "3bb63033308cb82dccdbe4bf2772ce3cf189f367", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.2.7", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" ], - "autorest_command": "autorest specification/connectedvmware/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.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/connectedvmware/resource-manager/readme.md --generate-sample=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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", "readme": "specification/connectedvmware/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_azure_arc_vmware_management_service_api.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_azure_arc_vmware_management_service_api.py index 6e46c53e59e8..1f902484e78b 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_azure_arc_vmware_management_service_api.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_azure_arc_vmware_management_service_api.py @@ -16,20 +16,18 @@ from ._configuration import AzureArcVMwareManagementServiceAPIConfiguration from ._serialization import Deserializer, Serializer from .operations import ( - AzureArcVMwareManagementServiceAPIOperationsMixin, ClustersOperations, DatastoresOperations, - GuestAgentsOperations, HostsOperations, - HybridIdentityMetadataOperations, InventoryItemsOperations, - MachineExtensionsOperations, Operations, ResourcePoolsOperations, VCentersOperations, + VMInstanceGuestAgentsOperations, + VirtualMachineInstancesOperations, VirtualMachineTemplatesOperations, - VirtualMachinesOperations, VirtualNetworksOperations, + VmInstanceHybridIdentityMetadataOperations, ) if TYPE_CHECKING: @@ -37,15 +35,11 @@ from azure.core.credentials import TokenCredential -class AzureArcVMwareManagementServiceAPI( - AzureArcVMwareManagementServiceAPIOperationsMixin -): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class AzureArcVMwareManagementServiceAPI: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Self service experience for VMware. :ivar operations: Operations operations :vartype operations: azure.mgmt.connectedvmware.operations.Operations - :ivar virtual_machines: VirtualMachinesOperations operations - :vartype virtual_machines: azure.mgmt.connectedvmware.operations.VirtualMachinesOperations :ivar resource_pools: ResourcePoolsOperations operations :vartype resource_pools: azure.mgmt.connectedvmware.operations.ResourcePoolsOperations :ivar clusters: ClustersOperations operations @@ -63,21 +57,24 @@ class AzureArcVMwareManagementServiceAPI( :vartype virtual_networks: azure.mgmt.connectedvmware.operations.VirtualNetworksOperations :ivar inventory_items: InventoryItemsOperations operations :vartype inventory_items: azure.mgmt.connectedvmware.operations.InventoryItemsOperations - :ivar hybrid_identity_metadata: HybridIdentityMetadataOperations operations - :vartype hybrid_identity_metadata: - azure.mgmt.connectedvmware.operations.HybridIdentityMetadataOperations - :ivar machine_extensions: MachineExtensionsOperations operations - :vartype machine_extensions: azure.mgmt.connectedvmware.operations.MachineExtensionsOperations - :ivar guest_agents: GuestAgentsOperations operations - :vartype guest_agents: azure.mgmt.connectedvmware.operations.GuestAgentsOperations + :ivar virtual_machine_instances: VirtualMachineInstancesOperations operations + :vartype virtual_machine_instances: + azure.mgmt.connectedvmware.operations.VirtualMachineInstancesOperations + :ivar vm_instance_hybrid_identity_metadata: VmInstanceHybridIdentityMetadataOperations + operations + :vartype vm_instance_hybrid_identity_metadata: + azure.mgmt.connectedvmware.operations.VmInstanceHybridIdentityMetadataOperations + :ivar vm_instance_guest_agents: VMInstanceGuestAgentsOperations operations + :vartype vm_instance_guest_agents: + azure.mgmt.connectedvmware.operations.VMInstanceGuestAgentsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The Subscription ID. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-07-15-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-10-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -93,16 +90,13 @@ def __init__( self._config = AzureArcVMwareManagementServiceAPIConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.virtual_machines = VirtualMachinesOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.resource_pools = ResourcePoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.clusters = ClustersOperations(self._client, self._config, self._serialize, self._deserialize) self.hosts = HostsOperations(self._client, self._config, self._serialize, self._deserialize) @@ -115,13 +109,15 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.inventory_items = InventoryItemsOperations(self._client, self._config, self._serialize, self._deserialize) - self.hybrid_identity_metadata = HybridIdentityMetadataOperations( + self.virtual_machine_instances = VirtualMachineInstancesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.vm_instance_hybrid_identity_metadata = VmInstanceHybridIdentityMetadataOperations( self._client, self._config, self._serialize, self._deserialize ) - self.machine_extensions = MachineExtensionsOperations( + self.vm_instance_guest_agents = VMInstanceGuestAgentsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.guest_agents = GuestAgentsOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. @@ -152,5 +148,5 @@ def __enter__(self) -> "AzureArcVMwareManagementServiceAPI": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_configuration.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_configuration.py index 843bd0cc1522..cf7b549430d8 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_configuration.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -35,14 +29,14 @@ class AzureArcVMwareManagementServiceAPIConfiguration(Configuration): # pylint: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The Subscription ID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-07-15-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-10-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(AzureArcVMwareManagementServiceAPIConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-07-15-preview"] = kwargs.pop("api_version", "2022-07-15-preview") + api_version: str = kwargs.pop("api_version", "2023-10-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_serialization.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_serialization.py index 2c170e28dbca..4bae2292227b 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_serialization.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_serialization.py @@ -38,7 +38,22 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore @@ -48,12 +63,14 @@ import isodate # type: ignore -from typing import Dict, Any, cast - from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + class RawDeserializer: @@ -277,8 +294,8 @@ class Model(object): _attribute_map: Dict[str, Dict[str, Any]] = {} _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: 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__) @@ -287,25 +304,25 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: cls._xml_map # type: ignore except AttributeError: @@ -322,7 +339,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -336,8 +353,13 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -384,7 +406,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -396,7 +418,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -409,8 +436,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -518,7 +545,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -534,7 +561,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -602,7 +629,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): @@ -626,8 +653,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -636,8 +662,9 @@ def _serialize(self, target_obj, data_type=None, **kwargs): _serialized.update(_new_attr) # type: ignore _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] - except ValueError: - continue + except ValueError as err: + if isinstance(err, SerializationError): + raise except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) @@ -656,8 +683,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -715,6 +742,8 @@ def query(self, name, data, data_type, **kwargs): :param 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 :raises: TypeError if serialization fails. :raises: ValueError if data is None @@ -723,10 +752,8 @@ def query(self, name, data, data_type, **kwargs): # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] - if not kwargs.get("skip_quote", False): - data = [quote(str(d), safe="") for d in data] - return str(self.serialize_iter(data, internal_data_type, **kwargs)) + do_quote = not kwargs.get("skip_quote", False) + return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -777,6 +804,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -863,6 +892,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): 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 """ if isinstance(data, str): @@ -875,9 +906,14 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): for d in data: try: serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized.append(None) + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + if div: serialized = ["" if s is None else str(s) for s in serialized] serialized = div.join(serialized) @@ -922,7 +958,9 @@ def serialize_dict(self, attr, dict_type, **kwargs): for key, value in attr.items(): try: serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized[self.serialize_unicode(key)] = None if "xml" in serialization_ctxt: @@ -1161,7 +1199,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1242,7 +1281,7 @@ def _extract_name_from_internal_type(internal_type): xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name @@ -1266,7 +1305,7 @@ def xml_key_extractor(attr, attr_desc, data): # Integrate namespace if necessary xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): @@ -1332,7 +1371,7 @@ class Deserializer(object): 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}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1352,7 +1391,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1471,7 +1510,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1486,7 +1525,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1496,7 +1535,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_vendor.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_vendor.py index 710e41c10fa4..0dafe0e287ff 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_vendor.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_vendor.py @@ -5,19 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from abc import ABC -from typing import TYPE_CHECKING - from azure.core.pipeline.transport import HttpRequest -from ._configuration import AzureArcVMwareManagementServiceAPIConfiguration - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core import PipelineClient - - from ._serialization import Deserializer, Serializer - def _convert_request(request, files=None): data = request.content if not files else None @@ -25,23 +14,3 @@ def _convert_request(request, files=None): if files: request.set_formdata_body(files) return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - formatted_components = template.split("/") - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) - - -class AzureArcVMwareManagementServiceAPIMixinABC(ABC): - """DO NOT use this class. It is for internal typing use only.""" - - _client: "PipelineClient" - _config: AzureArcVMwareManagementServiceAPIConfiguration - _serialize: "Serializer" - _deserialize: "Deserializer" diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_version.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_version.py index 20971492f129..e5754a47ce68 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_version.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b3" +VERSION = "1.0.0b1" diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/_azure_arc_vmware_management_service_api.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/_azure_arc_vmware_management_service_api.py index 26fae8bb9131..0aac34d7442d 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/_azure_arc_vmware_management_service_api.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/_azure_arc_vmware_management_service_api.py @@ -16,20 +16,18 @@ from .._serialization import Deserializer, Serializer from ._configuration import AzureArcVMwareManagementServiceAPIConfiguration from .operations import ( - AzureArcVMwareManagementServiceAPIOperationsMixin, ClustersOperations, DatastoresOperations, - GuestAgentsOperations, HostsOperations, - HybridIdentityMetadataOperations, InventoryItemsOperations, - MachineExtensionsOperations, Operations, ResourcePoolsOperations, VCentersOperations, + VMInstanceGuestAgentsOperations, + VirtualMachineInstancesOperations, VirtualMachineTemplatesOperations, - VirtualMachinesOperations, VirtualNetworksOperations, + VmInstanceHybridIdentityMetadataOperations, ) if TYPE_CHECKING: @@ -37,15 +35,11 @@ from azure.core.credentials_async import AsyncTokenCredential -class AzureArcVMwareManagementServiceAPI( - AzureArcVMwareManagementServiceAPIOperationsMixin -): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class AzureArcVMwareManagementServiceAPI: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes """Self service experience for VMware. :ivar operations: Operations operations :vartype operations: azure.mgmt.connectedvmware.aio.operations.Operations - :ivar virtual_machines: VirtualMachinesOperations operations - :vartype virtual_machines: azure.mgmt.connectedvmware.aio.operations.VirtualMachinesOperations :ivar resource_pools: ResourcePoolsOperations operations :vartype resource_pools: azure.mgmt.connectedvmware.aio.operations.ResourcePoolsOperations :ivar clusters: ClustersOperations operations @@ -63,22 +57,24 @@ class AzureArcVMwareManagementServiceAPI( :vartype virtual_networks: azure.mgmt.connectedvmware.aio.operations.VirtualNetworksOperations :ivar inventory_items: InventoryItemsOperations operations :vartype inventory_items: azure.mgmt.connectedvmware.aio.operations.InventoryItemsOperations - :ivar hybrid_identity_metadata: HybridIdentityMetadataOperations operations - :vartype hybrid_identity_metadata: - azure.mgmt.connectedvmware.aio.operations.HybridIdentityMetadataOperations - :ivar machine_extensions: MachineExtensionsOperations operations - :vartype machine_extensions: - azure.mgmt.connectedvmware.aio.operations.MachineExtensionsOperations - :ivar guest_agents: GuestAgentsOperations operations - :vartype guest_agents: azure.mgmt.connectedvmware.aio.operations.GuestAgentsOperations + :ivar virtual_machine_instances: VirtualMachineInstancesOperations operations + :vartype virtual_machine_instances: + azure.mgmt.connectedvmware.aio.operations.VirtualMachineInstancesOperations + :ivar vm_instance_hybrid_identity_metadata: VmInstanceHybridIdentityMetadataOperations + operations + :vartype vm_instance_hybrid_identity_metadata: + azure.mgmt.connectedvmware.aio.operations.VmInstanceHybridIdentityMetadataOperations + :ivar vm_instance_guest_agents: VMInstanceGuestAgentsOperations operations + :vartype vm_instance_guest_agents: + azure.mgmt.connectedvmware.aio.operations.VMInstanceGuestAgentsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The Subscription ID. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-07-15-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-10-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -94,16 +90,13 @@ def __init__( self._config = AzureArcVMwareManagementServiceAPIConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.virtual_machines = VirtualMachinesOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.resource_pools = ResourcePoolsOperations(self._client, self._config, self._serialize, self._deserialize) self.clusters = ClustersOperations(self._client, self._config, self._serialize, self._deserialize) self.hosts = HostsOperations(self._client, self._config, self._serialize, self._deserialize) @@ -116,13 +109,15 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.inventory_items = InventoryItemsOperations(self._client, self._config, self._serialize, self._deserialize) - self.hybrid_identity_metadata = HybridIdentityMetadataOperations( + self.virtual_machine_instances = VirtualMachineInstancesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.vm_instance_hybrid_identity_metadata = VmInstanceHybridIdentityMetadataOperations( self._client, self._config, self._serialize, self._deserialize ) - self.machine_extensions = MachineExtensionsOperations( + self.vm_instance_guest_agents = VMInstanceGuestAgentsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.guest_agents = GuestAgentsOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. @@ -153,5 +148,5 @@ async def __aenter__(self) -> "AzureArcVMwareManagementServiceAPI": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/_configuration.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/_configuration.py index d02373590f91..c8edbdf6dc02 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/_configuration.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -35,14 +29,14 @@ class AzureArcVMwareManagementServiceAPIConfiguration(Configuration): # pylint: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The Subscription ID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-07-15-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-10-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(AzureArcVMwareManagementServiceAPIConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-07-15-preview"] = kwargs.pop("api_version", "2022-07-15-preview") + api_version: str = kwargs.pop("api_version", "2023-10-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/_vendor.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/_vendor.py deleted file mode 100644 index d2f6cd2eaf38..000000000000 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/_vendor.py +++ /dev/null @@ -1,28 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from abc import ABC -from typing import TYPE_CHECKING - -from azure.core.pipeline.transport import HttpRequest - -from ._configuration import AzureArcVMwareManagementServiceAPIConfiguration - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core import AsyncPipelineClient - - from .._serialization import Deserializer, Serializer - - -class AzureArcVMwareManagementServiceAPIMixinABC(ABC): - """DO NOT use this class. It is for internal typing use only.""" - - _client: "AsyncPipelineClient" - _config: AzureArcVMwareManagementServiceAPIConfiguration - _serialize: "Serializer" - _deserialize: "Deserializer" diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/__init__.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/__init__.py index 5cf879bbc55c..d0665772204e 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/__init__.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/__init__.py @@ -7,7 +7,6 @@ # -------------------------------------------------------------------------- from ._operations import Operations -from ._virtual_machines_operations import VirtualMachinesOperations from ._resource_pools_operations import ResourcePoolsOperations from ._clusters_operations import ClustersOperations from ._hosts_operations import HostsOperations @@ -16,10 +15,9 @@ from ._virtual_machine_templates_operations import VirtualMachineTemplatesOperations from ._virtual_networks_operations import VirtualNetworksOperations from ._inventory_items_operations import InventoryItemsOperations -from ._hybrid_identity_metadata_operations import HybridIdentityMetadataOperations -from ._machine_extensions_operations import MachineExtensionsOperations -from ._azure_arc_vmware_management_service_api_operations import AzureArcVMwareManagementServiceAPIOperationsMixin -from ._guest_agents_operations import GuestAgentsOperations +from ._virtual_machine_instances_operations import VirtualMachineInstancesOperations +from ._vm_instance_hybrid_identity_metadata_operations import VmInstanceHybridIdentityMetadataOperations +from ._vm_instance_guest_agents_operations import VMInstanceGuestAgentsOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -27,7 +25,6 @@ __all__ = [ "Operations", - "VirtualMachinesOperations", "ResourcePoolsOperations", "ClustersOperations", "HostsOperations", @@ -36,10 +33,9 @@ "VirtualMachineTemplatesOperations", "VirtualNetworksOperations", "InventoryItemsOperations", - "HybridIdentityMetadataOperations", - "MachineExtensionsOperations", - "AzureArcVMwareManagementServiceAPIOperationsMixin", - "GuestAgentsOperations", + "VirtualMachineInstancesOperations", + "VmInstanceHybridIdentityMetadataOperations", + "VMInstanceGuestAgentsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_azure_arc_vmware_management_service_api_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_azure_arc_vmware_management_service_api_operations.py deleted file mode 100644 index bf729bf31060..000000000000 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_azure_arc_vmware_management_service_api_operations.py +++ /dev/null @@ -1,259 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._azure_arc_vmware_management_service_api_operations import build_upgrade_extensions_request -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AzureArcVMwareManagementServiceAPIOperationsMixin(AzureArcVMwareManagementServiceAPIMixinABC): - async def _upgrade_extensions_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - virtual_machine_name: str, - extension_upgrade_parameters: Union[_models.MachineExtensionUpgrade, IO], - **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(extension_upgrade_parameters, (IO, bytes)): - _content = extension_upgrade_parameters - else: - _json = self._serialize.body(extension_upgrade_parameters, "MachineExtensionUpgrade") - - request = build_upgrade_extensions_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._upgrade_extensions_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _upgrade_extensions_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/upgradeExtensions" - } - - @overload - async def begin_upgrade_extensions( - self, - resource_group_name: str, - virtual_machine_name: str, - extension_upgrade_parameters: _models.MachineExtensionUpgrade, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to Upgrade Machine Extensions. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the machine containing the extension. Required. - :type virtual_machine_name: str - :param extension_upgrade_parameters: Parameters supplied to the Upgrade Extensions operation. - Required. - :type extension_upgrade_parameters: ~azure.mgmt.connectedvmware.models.MachineExtensionUpgrade - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_upgrade_extensions( - self, - resource_group_name: str, - virtual_machine_name: str, - extension_upgrade_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to Upgrade Machine Extensions. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the machine containing the extension. Required. - :type virtual_machine_name: str - :param extension_upgrade_parameters: Parameters supplied to the Upgrade Extensions operation. - Required. - :type extension_upgrade_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_upgrade_extensions( - self, - resource_group_name: str, - virtual_machine_name: str, - extension_upgrade_parameters: Union[_models.MachineExtensionUpgrade, IO], - **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to Upgrade Machine Extensions. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the machine containing the extension. Required. - :type virtual_machine_name: str - :param extension_upgrade_parameters: Parameters supplied to the Upgrade Extensions operation. - Is either a model type or a IO type. Required. - :type extension_upgrade_parameters: ~azure.mgmt.connectedvmware.models.MachineExtensionUpgrade - or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = 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) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._upgrade_extensions_initial( # type: ignore - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - extension_upgrade_parameters=extension_upgrade_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_upgrade_extensions.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/upgradeExtensions" - } diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_clusters_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_clusters_operations.py index a1e618a80fd2..40297606cbf9 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_clusters_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_clusters_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,12 +39,7 @@ build_list_request, build_update_request, ) -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,16 +81,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Cluster] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -118,8 +111,9 @@ async def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -234,7 +228,7 @@ async def begin_create( :type resource_group_name: str :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a Cluster type or a IO type. Default value is None. :type body: ~azure.mgmt.connectedvmware.models.Cluster or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -255,9 +249,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Cluster] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -331,9 +323,7 @@ async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Cluster] = kwargs.pop("cls", None) request = build_get_request( @@ -348,8 +338,9 @@ async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -444,8 +435,8 @@ async def update( :type resource_group_name: str :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param body: Resource properties to update. Is either a model type or a IO type. Default value - is None. + :param body: Resource properties to update. Is either a ResourcePatch type or a IO type. + Default value is None. :type body: ~azure.mgmt.connectedvmware.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -466,16 +457,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Cluster] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -498,8 +487,9 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -534,9 +524,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -552,8 +540,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -563,8 +552,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/clusters/{clusterName}" @@ -599,9 +592,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -656,9 +647,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Cluster"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClustersList] = kwargs.pop("cls", None) error_map = { @@ -710,8 +699,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -742,9 +732,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClustersList] = kwargs.pop("cls", None) error_map = { @@ -797,8 +785,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_datastores_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_datastores_operations.py index 3aa23149eda9..680ae987f740 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_datastores_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_datastores_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,12 +39,7 @@ build_list_request, build_update_request, ) -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,16 +81,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Datastore] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -118,8 +111,9 @@ async def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -234,7 +228,7 @@ async def begin_create( :type resource_group_name: str :param datastore_name: Name of the datastore. Required. :type datastore_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a Datastore type or a IO type. Default value is None. :type body: ~azure.mgmt.connectedvmware.models.Datastore or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -255,9 +249,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Datastore] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -331,9 +323,7 @@ async def get(self, resource_group_name: str, datastore_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Datastore] = kwargs.pop("cls", None) request = build_get_request( @@ -348,8 +338,9 @@ async def get(self, resource_group_name: str, datastore_name: str, **kwargs: Any request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -444,8 +435,8 @@ async def update( :type resource_group_name: str :param datastore_name: Name of the datastore. Required. :type datastore_name: str - :param body: Resource properties to update. Is either a model type or a IO type. Default value - is None. + :param body: Resource properties to update. Is either a ResourcePatch type or a IO type. + Default value is None. :type body: ~azure.mgmt.connectedvmware.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -466,16 +457,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Datastore] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -498,8 +487,9 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -534,9 +524,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -552,8 +540,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -563,8 +552,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/datastores/{datastoreName}" @@ -599,9 +592,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -656,9 +647,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Datastore"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DatastoresList] = kwargs.pop("cls", None) error_map = { @@ -710,8 +699,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -742,9 +732,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DatastoresList] = kwargs.pop("cls", None) error_map = { @@ -797,8 +785,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_hosts_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_hosts_operations.py index 23670f6b2c3e..c7e21782bdc4 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_hosts_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_hosts_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,12 +39,7 @@ build_list_request, build_update_request, ) -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,16 +77,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Host] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -114,8 +107,9 @@ async def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -224,7 +218,7 @@ async def begin_create( :type resource_group_name: str :param host_name: Name of the host. Required. :type host_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a Host type or a IO type. Default value is None. :type body: ~azure.mgmt.connectedvmware.models.Host or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -244,9 +238,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Host] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -320,9 +312,7 @@ async def get(self, resource_group_name: str, host_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Host] = kwargs.pop("cls", None) request = build_get_request( @@ -337,8 +327,9 @@ async def get(self, resource_group_name: str, host_name: str, **kwargs: Any) -> request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -433,8 +424,8 @@ async def update( :type resource_group_name: str :param host_name: Name of the host. Required. :type host_name: str - :param body: Resource properties to update. Is either a model type or a IO type. Default value - is None. + :param body: Resource properties to update. Is either a ResourcePatch type or a IO type. + Default value is None. :type body: ~azure.mgmt.connectedvmware.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -455,16 +446,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Host] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -487,8 +476,9 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -523,9 +513,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -541,8 +529,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -552,8 +541,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/hosts/{hostName}" @@ -588,9 +581,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -645,9 +636,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Host"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HostsList] = kwargs.pop("cls", None) error_map = { @@ -699,8 +688,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -731,9 +721,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HostsList] = kwargs.pop("cls", None) error_map = { @@ -786,8 +774,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_hybrid_identity_metadata_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_hybrid_identity_metadata_operations.py deleted file mode 100644 index a22686840cbc..000000000000 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_hybrid_identity_metadata_operations.py +++ /dev/null @@ -1,456 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._hybrid_identity_metadata_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_request, -) -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class HybridIdentityMetadataOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.connectedvmware.aio.AzureArcVMwareManagementServiceAPI`'s - :attr:`hybrid_identity_metadata` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - async def create( - self, - resource_group_name: str, - virtual_machine_name: str, - metadata_name: str, - body: Optional[_models.HybridIdentityMetadata] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.HybridIdentityMetadata: - """Implements HybridIdentityMetadata PUT method. - - Create Or Update HybridIdentityMetadata. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param metadata_name: Name of the hybridIdentityMetadata. Required. - :type metadata_name: str - :param body: Request payload. Default value is None. - :type body: ~azure.mgmt.connectedvmware.models.HybridIdentityMetadata - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: HybridIdentityMetadata or the result of cls(response) - :rtype: ~azure.mgmt.connectedvmware.models.HybridIdentityMetadata - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, - resource_group_name: str, - virtual_machine_name: str, - metadata_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.HybridIdentityMetadata: - """Implements HybridIdentityMetadata PUT method. - - Create Or Update HybridIdentityMetadata. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param metadata_name: Name of the hybridIdentityMetadata. Required. - :type metadata_name: str - :param body: Request payload. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: HybridIdentityMetadata or the result of cls(response) - :rtype: ~azure.mgmt.connectedvmware.models.HybridIdentityMetadata - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, - resource_group_name: str, - virtual_machine_name: str, - metadata_name: str, - body: Optional[Union[_models.HybridIdentityMetadata, IO]] = None, - **kwargs: Any - ) -> _models.HybridIdentityMetadata: - """Implements HybridIdentityMetadata PUT method. - - Create Or Update HybridIdentityMetadata. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param metadata_name: Name of the hybridIdentityMetadata. Required. - :type metadata_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. - :type body: ~azure.mgmt.connectedvmware.models.HybridIdentityMetadata or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: HybridIdentityMetadata or the result of cls(response) - :rtype: ~azure.mgmt.connectedvmware.models.HybridIdentityMetadata - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = 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.HybridIdentityMetadata] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IO, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "HybridIdentityMetadata") - else: - _json = None - - request = build_create_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - metadata_name=metadata_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("HybridIdentityMetadata", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName}" - } - - @distributed_trace_async - async def get( - self, resource_group_name: str, virtual_machine_name: str, metadata_name: str, **kwargs: Any - ) -> _models.HybridIdentityMetadata: - """Gets HybridIdentityMetadata. - - Implements HybridIdentityMetadata GET method. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param metadata_name: Name of the HybridIdentityMetadata. Required. - :type metadata_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: HybridIdentityMetadata or the result of cls(response) - :rtype: ~azure.mgmt.connectedvmware.models.HybridIdentityMetadata - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.HybridIdentityMetadata] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - metadata_name=metadata_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("HybridIdentityMetadata", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName}" - } - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtual_machine_name: str, metadata_name: str, **kwargs: Any - ) -> None: - """Deletes an HybridIdentityMetadata. - - Implements HybridIdentityMetadata DELETE method. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param metadata_name: Name of the HybridIdentityMetadata. Required. - :type metadata_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - metadata_name=metadata_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName}" - } - - @distributed_trace - def list( - self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any - ) -> AsyncIterable["_models.HybridIdentityMetadata"]: - """Implements GET HybridIdentityMetadata in a vm. - - Returns the list of HybridIdentityMetadata of the given vm. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either HybridIdentityMetadata or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.connectedvmware.models.HybridIdentityMetadata] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.HybridIdentityMetadataList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("HybridIdentityMetadataList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/hybridIdentityMetadata" - } diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_inventory_items_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_inventory_items_operations.py index c3b5d41cc9b4..f0d8b0df9ae5 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_inventory_items_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_inventory_items_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -35,12 +35,7 @@ build_get_request, build_list_by_v_center_request, ) -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -147,7 +142,8 @@ async def create( :type vcenter_name: str :param inventory_item_name: Name of the inventoryItem. Required. :type inventory_item_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a InventoryItem type or a IO type. Default value is + None. :type body: ~azure.mgmt.connectedvmware.models.InventoryItem or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -168,16 +164,14 @@ async def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.InventoryItem] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -201,8 +195,9 @@ async def create( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -253,9 +248,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.InventoryItem] = kwargs.pop("cls", None) request = build_get_request( @@ -271,8 +264,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -323,9 +317,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -341,8 +333,9 @@ async def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -380,9 +373,7 @@ def list_by_v_center( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.InventoryItemsList] = kwargs.pop("cls", None) error_map = { @@ -436,8 +427,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_machine_extensions_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_machine_extensions_operations.py deleted file mode 100644 index 7dc1e2cc6e15..000000000000 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_machine_extensions_operations.py +++ /dev/null @@ -1,842 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._machine_extensions_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class MachineExtensionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.connectedvmware.aio.AzureArcVMwareManagementServiceAPI`'s - :attr:`machine_extensions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - async def _create_or_update_initial( - self, - resource_group_name: str, - virtual_machine_name: str, - extension_name: str, - extension_parameters: Union[_models.MachineExtension, IO], - **kwargs: Any - ) -> _models.MachineExtension: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = 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.MachineExtension] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(extension_parameters, (IO, bytes)): - _content = extension_parameters - else: - _json = self._serialize.body(extension_parameters, "MachineExtension") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - extension_name=extension_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_or_update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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("MachineExtension", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("MachineExtension", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/extensions/{extensionName}" - } - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - virtual_machine_name: str, - extension_name: str, - extension_parameters: _models.MachineExtension, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.MachineExtension]: - """The operation to create or update the extension. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the machine where the extension should be created or - updated. Required. - :type virtual_machine_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. - Required. - :type extension_parameters: ~azure.mgmt.connectedvmware.models.MachineExtension - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.connectedvmware.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - virtual_machine_name: str, - extension_name: str, - extension_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.MachineExtension]: - """The operation to create or update the extension. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the machine where the extension should be created or - updated. Required. - :type virtual_machine_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. - Required. - :type extension_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.connectedvmware.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - virtual_machine_name: str, - extension_name: str, - extension_parameters: Union[_models.MachineExtension, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.MachineExtension]: - """The operation to create or update the extension. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the machine where the extension should be created or - updated. Required. - :type virtual_machine_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. Is - either a model type or a IO type. Required. - :type extension_parameters: ~azure.mgmt.connectedvmware.models.MachineExtension or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.connectedvmware.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = 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.MachineExtension] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - extension_name=extension_name, - extension_parameters=extension_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MachineExtension", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/extensions/{extensionName}" - } - - async def _update_initial( - self, - resource_group_name: str, - virtual_machine_name: str, - extension_name: str, - extension_parameters: Union[_models.MachineExtensionUpdate, IO], - **kwargs: Any - ) -> _models.MachineExtension: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = 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.MachineExtension] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(extension_parameters, (IO, bytes)): - _content = extension_parameters - else: - _json = self._serialize.body(extension_parameters, "MachineExtensionUpdate") - - request = build_update_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - extension_name=extension_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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("MachineExtension", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("MachineExtension", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/extensions/{extensionName}" - } - - @overload - async def begin_update( - self, - resource_group_name: str, - virtual_machine_name: str, - extension_name: str, - extension_parameters: _models.MachineExtensionUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.MachineExtension]: - """The operation to update the extension. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the machine where the extension should be created or - updated. Required. - :type virtual_machine_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. - Required. - :type extension_parameters: ~azure.mgmt.connectedvmware.models.MachineExtensionUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.connectedvmware.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - virtual_machine_name: str, - extension_name: str, - extension_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.MachineExtension]: - """The operation to update the extension. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the machine where the extension should be created or - updated. Required. - :type virtual_machine_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. - Required. - :type extension_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.connectedvmware.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - virtual_machine_name: str, - extension_name: str, - extension_parameters: Union[_models.MachineExtensionUpdate, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.MachineExtension]: - """The operation to update the extension. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the machine where the extension should be created or - updated. Required. - :type virtual_machine_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. Is - either a model type or a IO type. Required. - :type extension_parameters: ~azure.mgmt.connectedvmware.models.MachineExtensionUpdate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.connectedvmware.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = 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.MachineExtension] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - extension_name=extension_name, - extension_parameters=extension_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MachineExtension", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/extensions/{extensionName}" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtual_machine_name: str, extension_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - extension_name=extension_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._delete_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/extensions/{extensionName}" - } - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, virtual_machine_name: str, extension_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to delete the extension. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the machine where the extension should be deleted. - Required. - :type virtual_machine_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - extension_name=extension_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/extensions/{extensionName}" - } - - @distributed_trace_async - async def get( - self, resource_group_name: str, virtual_machine_name: str, extension_name: str, **kwargs: Any - ) -> _models.MachineExtension: - """The operation to get the extension. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the machine containing the extension. Required. - :type virtual_machine_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: MachineExtension or the result of cls(response) - :rtype: ~azure.mgmt.connectedvmware.models.MachineExtension - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.MachineExtension] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - extension_name=extension_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MachineExtension", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/extensions/{extensionName}" - } - - @distributed_trace - def list( - self, resource_group_name: str, virtual_machine_name: str, expand: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.MachineExtension"]: - """The operation to get all extensions of a non-Azure machine. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the machine containing the extension. Required. - :type virtual_machine_name: str - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MachineExtension or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.connectedvmware.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.MachineExtensionsListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("MachineExtensionsListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/extensions" - } diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_operations.py index d1fce80456cb..4ac18756a386 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -29,12 +28,7 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,9 +64,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationsList] = kwargs.pop("cls", None) error_map = { @@ -123,8 +115,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_resource_pools_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_resource_pools_operations.py index cca6d9a8866d..eac6bb49b13f 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_resource_pools_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_resource_pools_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,12 +39,7 @@ build_list_request, build_update_request, ) -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,16 +81,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.ResourcePool] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -118,8 +111,9 @@ async def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -234,7 +228,8 @@ async def begin_create( :type resource_group_name: str :param resource_pool_name: Name of the resourcePool. Required. :type resource_pool_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a ResourcePool type or a IO type. Default value is + None. :type body: ~azure.mgmt.connectedvmware.models.ResourcePool or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -255,9 +250,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.ResourcePool] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -331,9 +324,7 @@ async def get(self, resource_group_name: str, resource_pool_name: str, **kwargs: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResourcePool] = kwargs.pop("cls", None) request = build_get_request( @@ -348,8 +339,9 @@ async def get(self, resource_group_name: str, resource_pool_name: str, **kwargs: request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -444,8 +436,8 @@ async def update( :type resource_group_name: str :param resource_pool_name: Name of the resourcePool. Required. :type resource_pool_name: str - :param body: Resource properties to update. Is either a model type or a IO type. Default value - is None. + :param body: Resource properties to update. Is either a ResourcePatch type or a IO type. + Default value is None. :type body: ~azure.mgmt.connectedvmware.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -466,16 +458,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.ResourcePool] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -498,8 +488,9 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -534,9 +525,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -552,8 +541,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -563,8 +553,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/resourcePools/{resourcePoolName}" @@ -599,9 +593,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -657,9 +649,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourcePool"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResourcePoolsList] = kwargs.pop("cls", None) error_map = { @@ -711,8 +701,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -744,9 +735,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResourcePoolsList] = kwargs.pop("cls", None) error_map = { @@ -799,8 +788,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_vcenters_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_vcenters_operations.py index 724690578480..60cceebfa52a 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_vcenters_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_vcenters_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,12 +39,7 @@ build_list_request, build_update_request, ) -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,16 +81,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VCenter] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -118,8 +111,9 @@ async def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -234,7 +228,7 @@ async def begin_create( :type resource_group_name: str :param vcenter_name: Name of the vCenter. Required. :type vcenter_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a VCenter type or a IO type. Default value is None. :type body: ~azure.mgmt.connectedvmware.models.VCenter or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -255,9 +249,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VCenter] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -331,9 +323,7 @@ async def get(self, resource_group_name: str, vcenter_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VCenter] = kwargs.pop("cls", None) request = build_get_request( @@ -348,8 +338,9 @@ async def get(self, resource_group_name: str, vcenter_name: str, **kwargs: Any) request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -444,8 +435,8 @@ async def update( :type resource_group_name: str :param vcenter_name: Name of the vCenter. Required. :type vcenter_name: str - :param body: Resource properties to update. Is either a model type or a IO type. Default value - is None. + :param body: Resource properties to update. Is either a ResourcePatch type or a IO type. + Default value is None. :type body: ~azure.mgmt.connectedvmware.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -466,16 +457,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VCenter] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -498,8 +487,9 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -534,9 +524,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -552,8 +540,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -563,8 +552,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/vcenters/{vcenterName}" @@ -599,9 +592,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -656,9 +647,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.VCenter"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VCentersList] = kwargs.pop("cls", None) error_map = { @@ -710,8 +699,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -742,9 +732,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VCentersList] = kwargs.pop("cls", None) error_map = { @@ -797,8 +785,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_virtual_machines_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_virtual_machine_instances_operations.py similarity index 51% rename from sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_virtual_machines_operations.py rename to sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_virtual_machine_instances_operations.py index c89481d966e2..9a6a664dfb32 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_virtual_machines_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_virtual_machine_instances_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -31,37 +31,29 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._virtual_machines_operations import ( - build_assess_patches_request, +from ...operations._virtual_machine_instances_operations import ( build_create_or_update_request, build_delete_request, build_get_request, - build_install_patches_request, - build_list_all_request, build_list_request, build_restart_request, build_start_request, build_stop_request, build_update_request, ) -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class VirtualMachinesOperations: +class VirtualMachineInstancesOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.connectedvmware.aio.AzureArcVMwareManagementServiceAPI`'s - :attr:`virtual_machines` attribute. + :attr:`virtual_machine_instances` attribute. """ models = _models @@ -73,374 +65,9 @@ def __init__(self, *args, **kwargs) -> None: 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") - async def _assess_patches_initial( - self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any - ) -> Optional[_models.VirtualMachineAssessPatchesResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[Optional[_models.VirtualMachineAssessPatchesResult]] = kwargs.pop("cls", None) - - request = build_assess_patches_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._assess_patches_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("VirtualMachineAssessPatchesResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _assess_patches_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/assessPatches" - } - - @distributed_trace_async - async def begin_assess_patches( - self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineAssessPatchesResult]: - """The operation to assess patches on a vSphere VMware machine identity in Azure. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the vSphere VMware machine. Required. - :type virtual_machine_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineAssessPatchesResult or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.connectedvmware.models.VirtualMachineAssessPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualMachineAssessPatchesResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._assess_patches_initial( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineAssessPatchesResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_assess_patches.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/assessPatches" - } - - async def _install_patches_initial( - self, - resource_group_name: str, - virtual_machine_name: str, - install_patches_input: Union[_models.VirtualMachineInstallPatchesParameters, IO], - **kwargs: Any - ) -> Optional[_models.VirtualMachineInstallPatchesResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = 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.VirtualMachineInstallPatchesResult]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(install_patches_input, (IO, bytes)): - _content = install_patches_input - else: - _json = self._serialize.body(install_patches_input, "VirtualMachineInstallPatchesParameters") - - request = build_install_patches_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._install_patches_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("VirtualMachineInstallPatchesResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _install_patches_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/installPatches" - } - - @overload - async def begin_install_patches( - self, - resource_group_name: str, - virtual_machine_name: str, - install_patches_input: _models.VirtualMachineInstallPatchesParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineInstallPatchesResult]: - """The operation to install patches on a vSphere VMware machine identity in Azure. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the vSphere VMware machine. Required. - :type virtual_machine_name: str - :param install_patches_input: Input for InstallPatches as directly received by the API. - Required. - :type install_patches_input: - ~azure.mgmt.connectedvmware.models.VirtualMachineInstallPatchesParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineInstallPatchesResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.connectedvmware.models.VirtualMachineInstallPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_install_patches( - self, - resource_group_name: str, - virtual_machine_name: str, - install_patches_input: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineInstallPatchesResult]: - """The operation to install patches on a vSphere VMware machine identity in Azure. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the vSphere VMware machine. Required. - :type virtual_machine_name: str - :param install_patches_input: Input for InstallPatches as directly received by the API. - Required. - :type install_patches_input: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineInstallPatchesResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.connectedvmware.models.VirtualMachineInstallPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_install_patches( - self, - resource_group_name: str, - virtual_machine_name: str, - install_patches_input: Union[_models.VirtualMachineInstallPatchesParameters, IO], - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachineInstallPatchesResult]: - """The operation to install patches on a vSphere VMware machine identity in Azure. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the vSphere VMware machine. Required. - :type virtual_machine_name: str - :param install_patches_input: Input for InstallPatches as directly received by the API. Is - either a model type or a IO type. Required. - :type install_patches_input: - ~azure.mgmt.connectedvmware.models.VirtualMachineInstallPatchesParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachineInstallPatchesResult - or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.connectedvmware.models.VirtualMachineInstallPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = 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.VirtualMachineInstallPatchesResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._install_patches_initial( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - install_patches_input=install_patches_input, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineInstallPatchesResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_install_patches.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/installPatches" - } - async def _create_or_update_initial( - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[Union[_models.VirtualMachine, IO]] = None, - **kwargs: Any - ) -> _models.VirtualMachine: + self, resource_uri: str, body: Optional[Union[_models.VirtualMachineInstance, IO]] = None, **kwargs: Any + ) -> _models.VirtualMachineInstance: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -452,27 +79,23 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VirtualMachine] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineInstance] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: - _json = self._serialize.body(body, "VirtualMachine") + _json = self._serialize.body(body, "VirtualMachineInstance") else: _json = None request = build_create_or_update_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, content_type=content_type, json=_json, @@ -484,8 +107,9 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -496,10 +120,10 @@ async def _create_or_update_initial( raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize("VirtualMachine", pipeline_response) + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) if response.status_code == 201: - deserialized = self._deserialize("VirtualMachine", pipeline_response) + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -507,29 +131,28 @@ async def _create_or_update_initial( return deserialized # type: ignore _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}" + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default" } @overload async def begin_create_or_update( self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[_models.VirtualMachine] = None, + resource_uri: str, + body: Optional[_models.VirtualMachineInstance] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachine]: + ) -> AsyncLROPoller[_models.VirtualMachineInstance]: """Implements virtual machine PUT method. - Create Or Update virtual machine. + The operation to create or update a virtual machine instance. Please note some properties can + be set only during virtual machine instance creation. - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the virtual machine resource. Required. - :type virtual_machine_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :param body: Request payload. Default value is None. - :type body: ~azure.mgmt.connectedvmware.models.VirtualMachine + :type body: ~azure.mgmt.connectedvmware.models.VirtualMachineInstance :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -541,30 +164,25 @@ async def begin_create_or_update( :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.connectedvmware.models.VirtualMachine] + :return: An instance of AsyncLROPoller that returns either VirtualMachineInstance or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.connectedvmware.models.VirtualMachineInstance] :raises ~azure.core.exceptions.HttpResponseError: """ @overload async def begin_create_or_update( - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachine]: + self, resource_uri: str, body: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineInstance]: """Implements virtual machine PUT method. - Create Or Update virtual machine. + The operation to create or update a virtual machine instance. Please note some properties can + be set only during virtual machine instance creation. - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the virtual machine resource. Required. - :type virtual_machine_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :param body: Request payload. Default value is None. :type body: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -578,30 +196,28 @@ async def begin_create_or_update( :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.connectedvmware.models.VirtualMachine] + :return: An instance of AsyncLROPoller that returns either VirtualMachineInstance or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.connectedvmware.models.VirtualMachineInstance] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async async def begin_create_or_update( - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[Union[_models.VirtualMachine, IO]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachine]: + self, resource_uri: str, body: Optional[Union[_models.VirtualMachineInstance, IO]] = None, **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineInstance]: """Implements virtual machine PUT method. - Create Or Update virtual machine. + The operation to create or update a virtual machine instance. Please note some properties can + be set only during virtual machine instance creation. - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the virtual machine resource. Required. - :type virtual_machine_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. - :type body: ~azure.mgmt.connectedvmware.models.VirtualMachine or IO + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Request payload. Is either a VirtualMachineInstance type or a IO type. Default + value is None. + :type body: ~azure.mgmt.connectedvmware.models.VirtualMachineInstance or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -613,26 +229,24 @@ async def begin_create_or_update( :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.connectedvmware.models.VirtualMachine] + :return: An instance of AsyncLROPoller that returns either VirtualMachineInstance or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.connectedvmware.models.VirtualMachineInstance] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VirtualMachine] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineInstance] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, + resource_uri=resource_uri, body=body, api_version=api_version, content_type=content_type, @@ -644,7 +258,7 @@ async def begin_create_or_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachine", pipeline_response) + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized @@ -668,22 +282,21 @@ def get_long_running_output(pipeline_response): return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}" + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default" } @distributed_trace_async - async def get(self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any) -> _models.VirtualMachine: + async def get(self, resource_uri: str, **kwargs: Any) -> _models.VirtualMachineInstance: """Gets a virtual machine. - Implements virtual machine GET method. + Retrieves information about a virtual machine instance. - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the virtual machine resource. Required. - :type virtual_machine_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: VirtualMachine or the result of cls(response) - :rtype: ~azure.mgmt.connectedvmware.models.VirtualMachine + :return: VirtualMachineInstance or the result of cls(response) + :rtype: ~azure.mgmt.connectedvmware.models.VirtualMachineInstance :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { @@ -697,15 +310,11 @@ async def get(self, resource_group_name: str, virtual_machine_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualMachineInstance] = kwargs.pop("cls", None) request = build_get_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, template_url=self.get.metadata["url"], headers=_headers, @@ -714,8 +323,9 @@ async def get(self, resource_group_name: str, virtual_machine_name: str, **kwarg request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -725,24 +335,18 @@ async def get(self, resource_group_name: str, virtual_machine_name: str, **kwarg error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("VirtualMachine", pipeline_response) + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}" - } + get.metadata = {"url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default"} async def _update_initial( - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[Union[_models.VirtualMachineUpdate, IO]] = None, - **kwargs: Any - ) -> Optional[_models.VirtualMachine]: + self, resource_uri: str, body: Optional[Union[_models.VirtualMachineInstanceUpdate, IO]] = None, **kwargs: Any + ) -> Optional[_models.VirtualMachineInstance]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, @@ -754,27 +358,23 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VirtualMachine]] = kwargs.pop("cls", None) + cls: ClsType[Optional[_models.VirtualMachineInstance]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: - _json = self._serialize.body(body, "VirtualMachineUpdate") + _json = self._serialize.body(body, "VirtualMachineInstanceUpdate") else: _json = None request = build_update_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, content_type=content_type, json=_json, @@ -786,53 +386,53 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 201, 202]: + if response.status_code not in [200, 202]: 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("VirtualMachine", pipeline_response) + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) - if response.status_code == 201: - deserialized = self._deserialize("VirtualMachine", pipeline_response) + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}" + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default" } @overload async def begin_update( self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[_models.VirtualMachineUpdate] = None, + resource_uri: str, + body: Optional[_models.VirtualMachineInstanceUpdate] = None, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachine]: + ) -> AsyncLROPoller[_models.VirtualMachineInstance]: """Updates a virtual machine. - API to update certain properties of the virtual machine resource. + The operation to update a virtual machine instance. - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the virtual machine resource. Required. - :type virtual_machine_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :param body: Resource properties to update. Default value is None. - :type body: ~azure.mgmt.connectedvmware.models.VirtualMachineUpdate + :type body: ~azure.mgmt.connectedvmware.models.VirtualMachineInstanceUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -844,30 +444,24 @@ async def begin_update( :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.connectedvmware.models.VirtualMachine] + :return: An instance of AsyncLROPoller that returns either VirtualMachineInstance or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.connectedvmware.models.VirtualMachineInstance] :raises ~azure.core.exceptions.HttpResponseError: """ @overload async def begin_update( - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachine]: + self, resource_uri: str, body: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineInstance]: """Updates a virtual machine. - API to update certain properties of the virtual machine resource. + The operation to update a virtual machine instance. - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the virtual machine resource. Required. - :type virtual_machine_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :param body: Resource properties to update. Default value is None. :type body: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -881,31 +475,27 @@ async def begin_update( :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.connectedvmware.models.VirtualMachine] + :return: An instance of AsyncLROPoller that returns either VirtualMachineInstance or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.connectedvmware.models.VirtualMachineInstance] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async async def begin_update( - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[Union[_models.VirtualMachineUpdate, IO]] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.VirtualMachine]: + self, resource_uri: str, body: Optional[Union[_models.VirtualMachineInstanceUpdate, IO]] = None, **kwargs: Any + ) -> AsyncLROPoller[_models.VirtualMachineInstance]: """Updates a virtual machine. - API to update certain properties of the virtual machine resource. + The operation to update a virtual machine instance. - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the virtual machine resource. Required. - :type virtual_machine_name: str - :param body: Resource properties to update. Is either a model type or a IO type. Default value - is None. - :type body: ~azure.mgmt.connectedvmware.models.VirtualMachineUpdate or IO + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Resource properties to update. Is either a VirtualMachineInstanceUpdate type or a + IO type. Default value is None. + :type body: ~azure.mgmt.connectedvmware.models.VirtualMachineInstanceUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -917,26 +507,24 @@ async def begin_update( :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.connectedvmware.models.VirtualMachine] + :return: An instance of AsyncLROPoller that returns either VirtualMachineInstance or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.connectedvmware.models.VirtualMachineInstance] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VirtualMachine] = kwargs.pop("cls", None) + cls: ClsType[_models.VirtualMachineInstance] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._update_initial( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, + resource_uri=resource_uri, body=body, api_version=api_version, content_type=content_type, @@ -948,13 +536,16 @@ async def begin_update( kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachine", pipeline_response) + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -969,16 +560,11 @@ def get_long_running_output(pipeline_response): return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}" + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default" } async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - virtual_machine_name: str, - retain: Optional[bool] = None, - force: Optional[bool] = None, - **kwargs: Any + self, resource_uri: str, delete_from_host: Optional[bool] = None, force: Optional[bool] = None, **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -991,16 +577,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - retain=retain, + resource_uri=resource_uri, + delete_from_host=delete_from_host, force=force, api_version=api_version, template_url=self._delete_initial.metadata["url"], @@ -1010,44 +592,42 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: 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 == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}" + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default" } @distributed_trace_async async def begin_delete( - self, - resource_group_name: str, - virtual_machine_name: str, - retain: Optional[bool] = None, - force: Optional[bool] = None, - **kwargs: Any + self, resource_uri: str, delete_from_host: Optional[bool] = None, force: Optional[bool] = None, **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes an virtual machine. - Implements virtual machine DELETE method. + The operation to delete a virtual machine instance. - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the virtual machine resource. Required. - :type virtual_machine_name: str - :param retain: Whether to just disable the VM from azure and retain the VM in the VMM. Default - value is None. - :type retain: bool + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param delete_from_host: Whether to delete the VM from the vCenter. Default value is None. + :type delete_from_host: bool :param force: Whether force delete was specified. Default value is None. :type force: bool :keyword callable cls: A custom type or function that will be passed the direct response @@ -1065,18 +645,15 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - retain=retain, + resource_uri=resource_uri, + delete_from_host=delete_from_host, force=force, api_version=api_version, cls=lambda x, y, z: x, @@ -1091,7 +668,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -1106,15 +686,99 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}" + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default" } + @distributed_trace + def list(self, resource_uri: str, **kwargs: Any) -> AsyncIterable["_models.VirtualMachineInstance"]: + """Implements List virtual machine instances. + + Lists all of the virtual machine instances within the specified parent resource. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineInstance or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.connectedvmware.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualMachineInstancesList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualMachineInstancesList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances"} + async def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[Union[_models.StopVirtualMachineOptions, IO]] = None, - **kwargs: Any + self, resource_uri: str, body: Optional[Union[_models.StopVirtualMachineOptions, IO]] = None, **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -1127,16 +791,14 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -1145,9 +807,7 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements _json = None request = build_stop_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, content_type=content_type, json=_json, @@ -1159,29 +819,32 @@ async def _stop_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202]: 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 = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _stop_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/stop" + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/stop" } @overload async def begin_stop( self, - resource_group_name: str, - virtual_machine_name: str, + resource_uri: str, body: Optional[_models.StopVirtualMachineOptions] = None, *, content_type: str = "application/json", @@ -1189,12 +852,11 @@ async def begin_stop( ) -> AsyncLROPoller[None]: """Implements the operation to stop a virtual machine. - Stop virtual machine. + The operation to power off (stop) a virtual machine instance. - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the virtual machine resource. Required. - :type virtual_machine_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :param body: Virtualmachine stop action payload. Default value is None. :type body: ~azure.mgmt.connectedvmware.models.StopVirtualMachineOptions :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -1215,22 +877,15 @@ async def begin_stop( @overload async def begin_stop( - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any + self, resource_uri: str, body: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[None]: """Implements the operation to stop a virtual machine. - Stop virtual machine. + The operation to power off (stop) a virtual machine instance. - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the virtual machine resource. Required. - :type virtual_machine_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :param body: Virtualmachine stop action payload. Default value is None. :type body: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -1251,22 +906,17 @@ async def begin_stop( @distributed_trace_async async def begin_stop( - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[Union[_models.StopVirtualMachineOptions, IO]] = None, - **kwargs: Any + self, resource_uri: str, body: Optional[Union[_models.StopVirtualMachineOptions, IO]] = None, **kwargs: Any ) -> AsyncLROPoller[None]: """Implements the operation to stop a virtual machine. - Stop virtual machine. + The operation to power off (stop) a virtual machine instance. - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the virtual machine resource. Required. - :type virtual_machine_name: str - :param body: Virtualmachine stop action payload. Is either a model type or a IO type. Default - value is None. + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Virtualmachine stop action payload. Is either a StopVirtualMachineOptions type or + a IO type. Default value is None. :type body: ~azure.mgmt.connectedvmware.models.StopVirtualMachineOptions or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1286,9 +936,7 @@ async def begin_stop( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -1296,8 +944,7 @@ async def begin_stop( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._stop_initial( # type: ignore - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, + resource_uri=resource_uri, body=body, api_version=api_version, content_type=content_type, @@ -1330,11 +977,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_stop.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/stop" + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/stop" } async def _start_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any + self, resource_uri: str, **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -1347,15 +994,11 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_start_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, template_url=self._start_initial.metadata["url"], headers=_headers, @@ -1364,36 +1007,37 @@ async def _start_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202]: 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 = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _start_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/start" + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/start" } @distributed_trace_async - async def begin_start( - self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_start(self, resource_uri: str, **kwargs: Any) -> AsyncLROPoller[None]: """Implements the operation to start a virtual machine. - Start virtual machine. + The operation to start a virtual machine instance. - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the virtual machine resource. Required. - :type virtual_machine_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1409,17 +1053,14 @@ async def begin_start( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._start_initial( # type: ignore - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, + resource_uri=resource_uri, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -1450,11 +1091,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_start.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/start" + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/start" } async def _restart_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any + self, resource_uri: str, **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -1467,15 +1108,11 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_restart_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, template_url=self._restart_initial.metadata["url"], headers=_headers, @@ -1484,36 +1121,37 @@ async def _restart_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202]: + if response.status_code not in [202]: 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 = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _restart_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/restart" + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/restart" } @distributed_trace_async - async def begin_restart( - self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_restart(self, resource_uri: str, **kwargs: Any) -> AsyncLROPoller[None]: """Implements the operation to restart a virtual machine. - Restart virtual machine. + The operation to restart a virtual machine instance. - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the virtual machine resource. Required. - :type virtual_machine_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -1529,17 +1167,14 @@ async def begin_restart( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._restart_initial( # type: ignore - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, + resource_uri=resource_uri, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -1570,182 +1205,5 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_restart.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/restart" - } - - @distributed_trace - def list_all(self, **kwargs: Any) -> AsyncIterable["_models.VirtualMachine"]: - """Implements GET virtualMachines in a subscription. - - List of virtualMachines in a subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either VirtualMachine or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.connectedvmware.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualMachinesList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_all_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_all.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualMachinesList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list_all.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines" - } - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.VirtualMachine"]: - """Implements GET virtualMachines in a resource group. - - List of virtualMachines in a resource group. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either VirtualMachine or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.connectedvmware.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualMachinesList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualMachinesList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines" + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/restart" } diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_virtual_machine_templates_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_virtual_machine_templates_operations.py index ace320990c5d..551f6627c717 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_virtual_machine_templates_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_virtual_machine_templates_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,12 +39,7 @@ build_list_request, build_update_request, ) -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,16 +81,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -118,8 +111,9 @@ async def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -236,7 +230,8 @@ async def begin_create( :type resource_group_name: str :param virtual_machine_template_name: Name of the virtual machine template resource. Required. :type virtual_machine_template_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a VirtualMachineTemplate type or a IO type. Default + value is None. :type body: ~azure.mgmt.connectedvmware.models.VirtualMachineTemplate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -258,9 +253,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -336,9 +329,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachineTemplate] = kwargs.pop("cls", None) request = build_get_request( @@ -353,8 +344,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -449,8 +441,8 @@ async def update( :type resource_group_name: str :param virtual_machine_template_name: Name of the virtual machine template resource. Required. :type virtual_machine_template_name: str - :param body: Resource properties to update. Is either a model type or a IO type. Default value - is None. + :param body: Resource properties to update. Is either a ResourcePatch type or a IO type. + Default value is None. :type body: ~azure.mgmt.connectedvmware.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -471,16 +463,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -503,8 +493,9 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -539,9 +530,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -557,8 +546,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -568,8 +558,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineTemplates/{virtualMachineTemplateName}" @@ -604,9 +598,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -663,9 +655,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.VirtualMachineTemplate"] _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachineTemplatesList] = kwargs.pop("cls", None) error_map = { @@ -717,8 +707,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -755,9 +746,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachineTemplatesList] = kwargs.pop("cls", None) error_map = { @@ -810,8 +799,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_virtual_networks_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_virtual_networks_operations.py index 40b3d321e3e6..bc4c29c80e1b 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_virtual_networks_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_virtual_networks_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -39,12 +39,7 @@ build_list_request, build_update_request, ) -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,16 +81,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -118,8 +111,9 @@ async def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -234,7 +228,8 @@ async def begin_create( :type resource_group_name: str :param virtual_network_name: Name of the virtual network resource. Required. :type virtual_network_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a VirtualNetwork type or a IO type. Default value is + None. :type body: ~azure.mgmt.connectedvmware.models.VirtualNetwork or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -255,9 +250,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -331,9 +324,7 @@ async def get(self, resource_group_name: str, virtual_network_name: str, **kwarg _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) request = build_get_request( @@ -348,8 +339,9 @@ async def get(self, resource_group_name: str, virtual_network_name: str, **kwarg request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -444,8 +436,8 @@ async def update( :type resource_group_name: str :param virtual_network_name: Name of the virtual network resource. Required. :type virtual_network_name: str - :param body: Resource properties to update. Is either a model type or a IO type. Default value - is None. + :param body: Resource properties to update. Is either a ResourcePatch type or a IO type. + Default value is None. :type body: ~azure.mgmt.connectedvmware.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -466,16 +458,14 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -498,8 +488,9 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -534,9 +525,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -552,8 +541,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -563,8 +553,12 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualNetworks/{virtualNetworkName}" @@ -599,9 +593,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -657,9 +649,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.VirtualNetwork"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualNetworksList] = kwargs.pop("cls", None) error_map = { @@ -711,8 +701,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -748,9 +739,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualNetworksList] = kwargs.pop("cls", None) error_map = { @@ -803,8 +792,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_guest_agents_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_vm_instance_guest_agents_operations.py similarity index 74% rename from sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_guest_agents_operations.py rename to sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_vm_instance_guest_agents_operations.py index 1da6c4592865..c8fb9d821690 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_guest_agents_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_vm_instance_guest_agents_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -31,30 +31,25 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._guest_agents_operations import ( +from ...operations._vm_instance_guest_agents_operations import ( build_create_request, build_delete_request, build_get_request, build_list_request, ) -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class GuestAgentsOperations: +class VMInstanceGuestAgentsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.connectedvmware.aio.AzureArcVMwareManagementServiceAPI`'s - :attr:`guest_agents` attribute. + :attr:`vm_instance_guest_agents` attribute. """ models = _models @@ -67,12 +62,7 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") async def _create_initial( - self, - resource_group_name: str, - virtual_machine_name: str, - name: str, - body: Optional[Union[_models.GuestAgent, IO]] = None, - **kwargs: Any + self, resource_uri: str, body: Optional[Union[_models.GuestAgent, IO]] = None, **kwargs: Any ) -> _models.GuestAgent: error_map = { 401: ClientAuthenticationError, @@ -85,16 +75,14 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -103,10 +91,7 @@ async def _create_initial( _json = None request = build_create_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - name=name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, content_type=content_type, json=_json, @@ -118,8 +103,9 @@ async def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -141,15 +127,13 @@ async def _create_initial( return deserialized # type: ignore _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/guestAgents/{name}" + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/guestAgents/default" } @overload async def begin_create( self, - resource_group_name: str, - virtual_machine_name: str, - name: str, + resource_uri: str, body: Optional[_models.GuestAgent] = None, *, content_type: str = "application/json", @@ -159,12 +143,9 @@ async def begin_create( Create Or Update GuestAgent. - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param name: Name of the guestAgents. Required. - :type name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :param body: Request payload. Default value is None. :type body: ~azure.mgmt.connectedvmware.models.GuestAgent :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -186,25 +167,15 @@ async def begin_create( @overload async def begin_create( - self, - resource_group_name: str, - virtual_machine_name: str, - name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any + self, resource_uri: str, body: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GuestAgent]: """Implements GuestAgent PUT method. Create Or Update GuestAgent. - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param name: Name of the guestAgents. Required. - :type name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :param body: Request payload. Default value is None. :type body: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -226,24 +197,16 @@ async def begin_create( @distributed_trace_async async def begin_create( - self, - resource_group_name: str, - virtual_machine_name: str, - name: str, - body: Optional[Union[_models.GuestAgent, IO]] = None, - **kwargs: Any + self, resource_uri: str, body: Optional[Union[_models.GuestAgent, IO]] = None, **kwargs: Any ) -> AsyncLROPoller[_models.GuestAgent]: """Implements GuestAgent PUT method. Create Or Update GuestAgent. - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param name: Name of the guestAgents. Required. - :type name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Request payload. Is either a GuestAgent type or a IO type. Default value is None. :type body: ~azure.mgmt.connectedvmware.models.GuestAgent or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -264,9 +227,7 @@ async def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -274,9 +235,7 @@ async def begin_create( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._create_initial( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - name=name, + resource_uri=resource_uri, body=body, api_version=api_version, content_type=content_type, @@ -312,23 +271,18 @@ def get_long_running_output(pipeline_response): return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/guestAgents/{name}" + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/guestAgents/default" } @distributed_trace_async - async def get( - self, resource_group_name: str, virtual_machine_name: str, name: str, **kwargs: Any - ) -> _models.GuestAgent: + async def get(self, resource_uri: str, **kwargs: Any) -> _models.GuestAgent: """Gets GuestAgent. Implements GuestAgent GET method. - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param name: Name of the GuestAgent. Required. - :type name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response :return: GuestAgent or the result of cls(response) :rtype: ~azure.mgmt.connectedvmware.models.GuestAgent @@ -345,16 +299,11 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GuestAgent] = kwargs.pop("cls", None) request = build_get_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - name=name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, template_url=self.get.metadata["url"], headers=_headers, @@ -363,8 +312,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -382,11 +332,11 @@ async def get( return deserialized get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/guestAgents/{name}" + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/guestAgents/default" } async def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtual_machine_name: str, name: str, **kwargs: Any + self, resource_uri: str, **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -399,16 +349,11 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - name=name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, template_url=self._delete_initial.metadata["url"], headers=_headers, @@ -417,38 +362,38 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: 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 == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/guestAgents/{name}" + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/guestAgents/default" } @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, virtual_machine_name: str, name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: + async def begin_delete(self, resource_uri: str, **kwargs: Any) -> AsyncLROPoller[None]: """Deletes an GuestAgent. Implements GuestAgent DELETE method. - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param name: Name of the GuestAgent. Required. - :type name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for @@ -464,18 +409,14 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - name=name, + resource_uri=resource_uri, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -504,21 +445,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/guestAgents/{name}" + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/guestAgents/default" } @distributed_trace - def list( - self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any - ) -> AsyncIterable["_models.GuestAgent"]: + def list(self, resource_uri: str, **kwargs: Any) -> AsyncIterable["_models.GuestAgent"]: """Implements GET GuestAgent in a vm. Returns the list of GuestAgent of the given vm. - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GuestAgent or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.connectedvmware.models.GuestAgent] @@ -527,9 +465,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GuestAgentList] = kwargs.pop("cls", None) error_map = { @@ -544,9 +480,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, template_url=self.list.metadata["url"], headers=_headers, @@ -583,8 +517,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -598,5 +533,5 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/guestAgents" + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/guestAgents" } diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_vm_instance_hybrid_identity_metadata_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_vm_instance_hybrid_identity_metadata_operations.py new file mode 100644 index 000000000000..a15a80c74553 --- /dev/null +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/aio/operations/_vm_instance_hybrid_identity_metadata_operations.py @@ -0,0 +1,205 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._vm_instance_hybrid_identity_metadata_operations import build_get_request, build_list_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class VmInstanceHybridIdentityMetadataOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.connectedvmware.aio.AzureArcVMwareManagementServiceAPI`'s + :attr:`vm_instance_hybrid_identity_metadata` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, resource_uri: str, **kwargs: Any) -> _models.VmInstanceHybridIdentityMetadata: + """Gets HybridIdentityMetadata. + + Implements HybridIdentityMetadata GET method. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VmInstanceHybridIdentityMetadata or the result of cls(response) + :rtype: ~azure.mgmt.connectedvmware.models.VmInstanceHybridIdentityMetadata + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VmInstanceHybridIdentityMetadata] = kwargs.pop("cls", None) + + request = build_get_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VmInstanceHybridIdentityMetadata", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/hybridIdentityMetadata/default" + } + + @distributed_trace + def list(self, resource_uri: str, **kwargs: Any) -> AsyncIterable["_models.VmInstanceHybridIdentityMetadata"]: + """Implements GET HybridIdentityMetadata in a vm. + + Returns the list of HybridIdentityMetadata of the given vm. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VmInstanceHybridIdentityMetadata or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.connectedvmware.models.VmInstanceHybridIdentityMetadata] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VmInstanceHybridIdentityMetadataList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("VmInstanceHybridIdentityMetadataList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/hybridIdentityMetadata" + } diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/models/__init__.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/models/__init__.py index 6ea441d3d777..3f487e6dfe5d 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/models/__init__.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/models/__init__.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._models_py3 import AvailablePatchCountByClassification from ._models_py3 import Cluster from ._models_py3 import ClusterInventoryItem from ._models_py3 import ClustersList @@ -18,32 +17,19 @@ from ._models_py3 import ErrorDetail from ._models_py3 import ErrorResponse from ._models_py3 import ExtendedLocation -from ._models_py3 import ExtensionTargetProperties from ._models_py3 import GuestAgent from ._models_py3 import GuestAgentList -from ._models_py3 import GuestAgentProfile -from ._models_py3 import GuestAgentProfileUpdate from ._models_py3 import GuestCredential from ._models_py3 import HardwareProfile from ._models_py3 import Host from ._models_py3 import HostInventoryItem from ._models_py3 import HostsList from ._models_py3 import HttpProxyConfiguration -from ._models_py3 import HybridIdentityMetadata -from ._models_py3 import HybridIdentityMetadataList -from ._models_py3 import Identity +from ._models_py3 import InfrastructureProfile from ._models_py3 import InventoryItem from ._models_py3 import InventoryItemDetails from ._models_py3 import InventoryItemProperties from ._models_py3 import InventoryItemsList -from ._models_py3 import LinuxParameters -from ._models_py3 import MachineExtension -from ._models_py3 import MachineExtensionInstanceView -from ._models_py3 import MachineExtensionInstanceViewStatus -from ._models_py3 import MachineExtensionPropertiesInstanceView -from ._models_py3 import MachineExtensionUpdate -from ._models_py3 import MachineExtensionUpgrade -from ._models_py3 import MachineExtensionsListResult from ._models_py3 import NetworkInterface from ._models_py3 import NetworkInterfaceUpdate from ._models_py3 import NetworkProfile @@ -53,12 +39,7 @@ from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import OperationsList -from ._models_py3 import OsProfile -from ._models_py3 import OsProfileLinuxConfiguration -from ._models_py3 import OsProfileUpdate -from ._models_py3 import OsProfileUpdateLinuxConfiguration -from ._models_py3 import OsProfileUpdateWindowsConfiguration -from ._models_py3 import OsProfileWindowsConfiguration +from ._models_py3 import OsProfileForVMInstance from ._models_py3 import PlacementProfile from ._models_py3 import ProxyResource from ._models_py3 import Resource @@ -78,52 +59,38 @@ from ._models_py3 import VICredential from ._models_py3 import VirtualDisk from ._models_py3 import VirtualDiskUpdate -from ._models_py3 import VirtualMachine -from ._models_py3 import VirtualMachineAssessPatchesResult -from ._models_py3 import VirtualMachineInstallPatchesParameters -from ._models_py3 import VirtualMachineInstallPatchesResult +from ._models_py3 import VirtualMachineInstance +from ._models_py3 import VirtualMachineInstanceUpdate +from ._models_py3 import VirtualMachineInstancesList from ._models_py3 import VirtualMachineInventoryItem from ._models_py3 import VirtualMachineTemplate from ._models_py3 import VirtualMachineTemplateInventoryItem from ._models_py3 import VirtualMachineTemplatesList -from ._models_py3 import VirtualMachineUpdate -from ._models_py3 import VirtualMachinesList from ._models_py3 import VirtualNetwork from ._models_py3 import VirtualNetworkInventoryItem from ._models_py3 import VirtualNetworksList from ._models_py3 import VirtualSCSIController -from ._models_py3 import WindowsParameters +from ._models_py3 import VmInstanceHybridIdentityMetadata +from ._models_py3 import VmInstanceHybridIdentityMetadataList from ._azure_arc_vmware_management_service_api_enums import CreatedByType from ._azure_arc_vmware_management_service_api_enums import DiskMode from ._azure_arc_vmware_management_service_api_enums import DiskType from ._azure_arc_vmware_management_service_api_enums import FirmwareType from ._azure_arc_vmware_management_service_api_enums import IPAddressAllocationMethod -from ._azure_arc_vmware_management_service_api_enums import IdentityType from ._azure_arc_vmware_management_service_api_enums import InventoryType from ._azure_arc_vmware_management_service_api_enums import NICType from ._azure_arc_vmware_management_service_api_enums import OsType -from ._azure_arc_vmware_management_service_api_enums import OsTypeUM -from ._azure_arc_vmware_management_service_api_enums import PatchOperationStartedBy -from ._azure_arc_vmware_management_service_api_enums import PatchOperationStatus -from ._azure_arc_vmware_management_service_api_enums import PatchServiceUsed from ._azure_arc_vmware_management_service_api_enums import PowerOnBootOption from ._azure_arc_vmware_management_service_api_enums import ProvisioningAction from ._azure_arc_vmware_management_service_api_enums import ProvisioningState from ._azure_arc_vmware_management_service_api_enums import SCSIControllerType -from ._azure_arc_vmware_management_service_api_enums import StatusLevelTypes -from ._azure_arc_vmware_management_service_api_enums import StatusTypes -from ._azure_arc_vmware_management_service_api_enums import VMGuestPatchClassificationLinux -from ._azure_arc_vmware_management_service_api_enums import VMGuestPatchClassificationWindows -from ._azure_arc_vmware_management_service_api_enums import VMGuestPatchRebootSetting -from ._azure_arc_vmware_management_service_api_enums import VMGuestPatchRebootStatus from ._azure_arc_vmware_management_service_api_enums import VirtualSCSISharing from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ - "AvailablePatchCountByClassification", "Cluster", "ClusterInventoryItem", "ClustersList", @@ -135,32 +102,19 @@ "ErrorDetail", "ErrorResponse", "ExtendedLocation", - "ExtensionTargetProperties", "GuestAgent", "GuestAgentList", - "GuestAgentProfile", - "GuestAgentProfileUpdate", "GuestCredential", "HardwareProfile", "Host", "HostInventoryItem", "HostsList", "HttpProxyConfiguration", - "HybridIdentityMetadata", - "HybridIdentityMetadataList", - "Identity", + "InfrastructureProfile", "InventoryItem", "InventoryItemDetails", "InventoryItemProperties", "InventoryItemsList", - "LinuxParameters", - "MachineExtension", - "MachineExtensionInstanceView", - "MachineExtensionInstanceViewStatus", - "MachineExtensionPropertiesInstanceView", - "MachineExtensionUpdate", - "MachineExtensionUpgrade", - "MachineExtensionsListResult", "NetworkInterface", "NetworkInterfaceUpdate", "NetworkProfile", @@ -170,12 +124,7 @@ "Operation", "OperationDisplay", "OperationsList", - "OsProfile", - "OsProfileLinuxConfiguration", - "OsProfileUpdate", - "OsProfileUpdateLinuxConfiguration", - "OsProfileUpdateWindowsConfiguration", - "OsProfileWindowsConfiguration", + "OsProfileForVMInstance", "PlacementProfile", "ProxyResource", "Resource", @@ -195,44 +144,31 @@ "VICredential", "VirtualDisk", "VirtualDiskUpdate", - "VirtualMachine", - "VirtualMachineAssessPatchesResult", - "VirtualMachineInstallPatchesParameters", - "VirtualMachineInstallPatchesResult", + "VirtualMachineInstance", + "VirtualMachineInstanceUpdate", + "VirtualMachineInstancesList", "VirtualMachineInventoryItem", "VirtualMachineTemplate", "VirtualMachineTemplateInventoryItem", "VirtualMachineTemplatesList", - "VirtualMachineUpdate", - "VirtualMachinesList", "VirtualNetwork", "VirtualNetworkInventoryItem", "VirtualNetworksList", "VirtualSCSIController", - "WindowsParameters", + "VmInstanceHybridIdentityMetadata", + "VmInstanceHybridIdentityMetadataList", "CreatedByType", "DiskMode", "DiskType", "FirmwareType", "IPAddressAllocationMethod", - "IdentityType", "InventoryType", "NICType", "OsType", - "OsTypeUM", - "PatchOperationStartedBy", - "PatchOperationStatus", - "PatchServiceUsed", "PowerOnBootOption", "ProvisioningAction", "ProvisioningState", "SCSIControllerType", - "StatusLevelTypes", - "StatusTypes", - "VMGuestPatchClassificationLinux", - "VMGuestPatchClassificationWindows", - "VMGuestPatchRebootSetting", - "VMGuestPatchRebootStatus", "VirtualSCSISharing", ] __all__.extend([p for p in _patch_all if p not in __all__]) diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/models/_azure_arc_vmware_management_service_api_enums.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/models/_azure_arc_vmware_management_service_api_enums.py index 21cebcdc47d1..159f51023444 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/models/_azure_arc_vmware_management_service_api_enums.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/models/_azure_arc_vmware_management_service_api_enums.py @@ -46,13 +46,6 @@ class FirmwareType(str, Enum, metaclass=CaseInsensitiveEnumMeta): EFI = "efi" -class IdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of managed service identity.""" - - NONE = "None" - SYSTEM_ASSIGNED = "SystemAssigned" - - class InventoryType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The inventory type.""" @@ -95,44 +88,6 @@ class OsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): OTHER = "Other" -class OsTypeUM(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The operating system type of the machine.""" - - WINDOWS = "Windows" - LINUX = "Linux" - - -class PatchOperationStartedBy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Indicates if operation was triggered by user or by platform.""" - - USER = "User" - PLATFORM = "Platform" - - -class PatchOperationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The overall success or failure status of the operation. It remains "InProgress" until the - operation completes. At that point it will become "Unknown", "Failed", "Succeeded", or - "CompletedWithWarnings.". - """ - - UNKNOWN = "Unknown" - IN_PROGRESS = "InProgress" - FAILED = "Failed" - SUCCEEDED = "Succeeded" - COMPLETED_WITH_WARNINGS = "CompletedWithWarnings" - - -class PatchServiceUsed(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Specifies the patch service used for the operation.""" - - UNKNOWN = "Unknown" - WU = "WU" - WU_WSUS = "WU_WSUS" - YUM = "YUM" - APT = "APT" - ZYPPER = "Zypper" - - class PowerOnBootOption(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Defines the options for power on boot.""" @@ -170,65 +125,9 @@ class SCSIControllerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): LSILOGICSAS = "lsilogicsas" -class StatusLevelTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The level code.""" - - INFO = "Info" - WARNING = "Warning" - ERROR = "Error" - - -class StatusTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The status of the hybrid machine agent.""" - - CONNECTED = "Connected" - DISCONNECTED = "Disconnected" - ERROR = "Error" - - class VirtualSCSISharing(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Defines the sharing mode for sharing the SCSI bus.""" NO_SHARING = "noSharing" PHYSICAL_SHARING = "physicalSharing" VIRTUAL_SHARING = "virtualSharing" - - -class VMGuestPatchClassificationLinux(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """VMGuestPatchClassificationLinux.""" - - CRITICAL = "Critical" - SECURITY = "Security" - OTHER = "Other" - - -class VMGuestPatchClassificationWindows(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """VMGuestPatchClassificationWindows.""" - - CRITICAL = "Critical" - SECURITY = "Security" - UPDATE_ROLL_UP = "UpdateRollUp" - FEATURE_PACK = "FeaturePack" - SERVICE_PACK = "ServicePack" - DEFINITION = "Definition" - TOOLS = "Tools" - UPDATES = "Updates" - - -class VMGuestPatchRebootSetting(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Defines when it is acceptable to reboot a VM during a software update operation.""" - - IF_REQUIRED = "IfRequired" - NEVER = "Never" - ALWAYS = "Always" - - -class VMGuestPatchRebootStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The reboot state of the VM following completion of the operation.""" - - UNKNOWN = "Unknown" - NOT_NEEDED = "NotNeeded" - REQUIRED = "Required" - STARTED = "Started" - FAILED = "Failed" - COMPLETED = "Completed" diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/models/_models_py3.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/models/_models_py3.py index d9bc40264e5c..e0bea5ed6fcd 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/models/_models_py3.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/models/_models_py3.py @@ -8,83 +8,13 @@ # -------------------------------------------------------------------------- import datetime -import sys from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from .. import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - - -class AvailablePatchCountByClassification(_serialization.Model): - """Summarization of patches available for installation on the machine by classification. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar security: Number of security patches available for installation. - :vartype security: int - :ivar critical: Number of critical patches available for installation. - :vartype critical: int - :ivar definition: Number of definition patches available for installation. - :vartype definition: int - :ivar update_rollup: Number of update Rollup patches available for installation. - :vartype update_rollup: int - :ivar feature_pack: Number of feature pack patches available for installation. - :vartype feature_pack: int - :ivar service_pack: Number of service pack patches available for installation. - :vartype service_pack: int - :ivar tools: Number of tools patches available for installation. - :vartype tools: int - :ivar updates: Number of updates category patches available for installation. - :vartype updates: int - :ivar other: Number of other patches available for installation. - :vartype other: int - """ - - _validation = { - "security": {"readonly": True}, - "critical": {"readonly": True}, - "definition": {"readonly": True}, - "update_rollup": {"readonly": True}, - "feature_pack": {"readonly": True}, - "service_pack": {"readonly": True}, - "tools": {"readonly": True}, - "updates": {"readonly": True}, - "other": {"readonly": True}, - } - - _attribute_map = { - "security": {"key": "security", "type": "int"}, - "critical": {"key": "critical", "type": "int"}, - "definition": {"key": "definition", "type": "int"}, - "update_rollup": {"key": "updateRollup", "type": "int"}, - "feature_pack": {"key": "featurePack", "type": "int"}, - "service_pack": {"key": "servicePack", "type": "int"}, - "tools": {"key": "tools", "type": "int"}, - "updates": {"key": "updates", "type": "int"}, - "other": {"key": "other", "type": "int"}, - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.security = None - self.critical = None - self.definition = None - self.update_rollup = None - self.feature_pack = None - self.service_pack = None - self.tools = None - self.updates = None - self.other = None class Cluster(_serialization.Model): # pylint: disable=too-many-instance-attributes @@ -127,12 +57,21 @@ class Cluster(_serialization.Model): # pylint: disable=too-many-instance-attrib :vartype statuses: list[~azure.mgmt.connectedvmware.models.ResourceStatus] :ivar custom_resource_name: Gets the name of the corresponding resource in Kubernetes. :vartype custom_resource_name: str - :ivar datastore_ids: Gets or sets the datastore ARM ids. + :ivar used_memory_gb: Gets the used physical memory on the cluster in GB. + :vartype used_memory_gb: int + :ivar total_memory_gb: Gets the total amount of physical memory on the cluster in GB. + :vartype total_memory_gb: int + :ivar used_cpu_m_hz: Gets the used CPU usage across all cores on the cluster in MHz. + :vartype used_cpu_m_hz: int + :ivar total_cpu_m_hz: Gets the max CPU usage across all cores on the cluster in MHz. + :vartype total_cpu_m_hz: int + :ivar datastore_ids: Gets the datastore ARM ids. :vartype datastore_ids: list[str] - :ivar network_ids: Gets or sets the network ARM ids. + :ivar network_ids: Gets the network ARM ids. :vartype network_ids: list[str] - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState """ _validation = { @@ -145,6 +84,10 @@ class Cluster(_serialization.Model): # pylint: disable=too-many-instance-attrib "mo_name": {"readonly": True}, "statuses": {"readonly": True}, "custom_resource_name": {"readonly": True}, + "used_memory_gb": {"readonly": True}, + "total_memory_gb": {"readonly": True}, + "used_cpu_m_hz": {"readonly": True}, + "total_cpu_m_hz": {"readonly": True}, "datastore_ids": {"readonly": True}, "network_ids": {"readonly": True}, "provisioning_state": {"readonly": True}, @@ -166,6 +109,10 @@ class Cluster(_serialization.Model): # pylint: disable=too-many-instance-attrib "mo_name": {"key": "properties.moName", "type": "str"}, "statuses": {"key": "properties.statuses", "type": "[ResourceStatus]"}, "custom_resource_name": {"key": "properties.customResourceName", "type": "str"}, + "used_memory_gb": {"key": "properties.usedMemoryGB", "type": "int"}, + "total_memory_gb": {"key": "properties.totalMemoryGB", "type": "int"}, + "used_cpu_m_hz": {"key": "properties.usedCpuMHz", "type": "int"}, + "total_cpu_m_hz": {"key": "properties.totalCpuMHz", "type": "int"}, "datastore_ids": {"key": "properties.datastoreIds", "type": "[str]"}, "network_ids": {"key": "properties.networkIds", "type": "[str]"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, @@ -181,8 +128,8 @@ def __init__( v_center_id: Optional[str] = None, mo_ref_id: Optional[str] = None, inventory_item_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Gets or sets the location. Required. :paramtype location: str @@ -219,6 +166,10 @@ def __init__( self.mo_name = None self.statuses = None self.custom_resource_name = None + self.used_memory_gb = None + self.total_memory_gb = None + self.used_cpu_m_hz = None + self.total_cpu_m_hz = None self.datastore_ids = None self.network_ids = None self.provisioning_state = None @@ -246,8 +197,9 @@ class InventoryItemProperties(_serialization.Model): :vartype mo_ref_id: str :ivar mo_name: Gets or sets the vCenter Managed Object name for the inventory item. :vartype mo_name: str - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState """ _validation = { @@ -281,8 +233,8 @@ def __init__( managed_resource_id: Optional[str] = None, mo_ref_id: Optional[str] = None, mo_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword managed_resource_id: Gets or sets the tracked resource id corresponding to the inventory resource. @@ -319,8 +271,9 @@ class ClusterInventoryItem(InventoryItemProperties): :vartype mo_ref_id: str :ivar mo_name: Gets or sets the vCenter Managed Object name for the inventory item. :vartype mo_name: str - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState """ _validation = { @@ -342,8 +295,8 @@ def __init__( managed_resource_id: Optional[str] = None, mo_ref_id: Optional[str] = None, mo_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword managed_resource_id: Gets or sets the tracked resource id corresponding to the inventory resource. @@ -378,7 +331,7 @@ class ClustersList(_serialization.Model): "value": {"key": "value", "type": "[Cluster]"}, } - def __init__(self, *, value: List["_models.Cluster"], next_link: Optional[str] = None, **kwargs): + def __init__(self, *, value: List["_models.Cluster"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: Url to follow for getting next page of Clusters. :paramtype next_link: str @@ -419,7 +372,7 @@ class Condition(_serialization.Model): "severity": {"key": "severity", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.status = None @@ -524,8 +477,8 @@ def __init__( v_center_id: Optional[str] = None, mo_ref_id: Optional[str] = None, inventory_item_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Gets or sets the location. Required. :paramtype location: str @@ -585,8 +538,9 @@ class DatastoreInventoryItem(InventoryItemProperties): :vartype mo_ref_id: str :ivar mo_name: Gets or sets the vCenter Managed Object name for the inventory item. :vartype mo_name: str - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState :ivar capacity_gb: Gets or sets Maximum capacity of this datastore, in GBs. :vartype capacity_gb: int :ivar free_space_gb: Gets or sets Available space of this datastore, in GBs. @@ -616,8 +570,8 @@ def __init__( mo_name: Optional[str] = None, capacity_gb: Optional[int] = None, free_space_gb: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword managed_resource_id: Gets or sets the tracked resource id corresponding to the inventory resource. @@ -658,7 +612,7 @@ class DatastoresList(_serialization.Model): "value": {"key": "value", "type": "[Datastore]"}, } - def __init__(self, *, value: List["_models.Datastore"], next_link: Optional[str] = None, **kwargs): + def __init__(self, *, value: List["_models.Datastore"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: Url to follow for getting next page of Datastores. :paramtype next_link: str @@ -691,7 +645,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -731,7 +685,7 @@ class ErrorDetail(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -742,7 +696,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). :ivar error: The error object. :vartype error: ~azure.mgmt.connectedvmware.models.ErrorDetail @@ -752,7 +707,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. :paramtype error: ~azure.mgmt.connectedvmware.models.ErrorDetail @@ -775,7 +730,7 @@ class ExtendedLocation(_serialization.Model): "name": {"key": "name", "type": "str"}, } - def __init__(self, *, type: Optional[str] = None, name: Optional[str] = None, **kwargs): + def __init__(self, *, type: Optional[str] = None, name: Optional[str] = None, **kwargs: Any) -> None: """ :keyword type: The extended location type. :paramtype type: str @@ -787,89 +742,81 @@ def __init__(self, *, type: Optional[str] = None, name: Optional[str] = None, ** self.name = name -class ExtensionTargetProperties(_serialization.Model): - """Describes the Machine Extension Target Version Properties. - - :ivar target_version: Properties for the specified Extension to Upgrade. - :vartype target_version: str - """ - - _attribute_map = { - "target_version": {"key": "targetVersion", "type": "str"}, - } - - def __init__(self, *, target_version: Optional[str] = None, **kwargs): - """ - :keyword target_version: Properties for the specified Extension to Upgrade. - :paramtype target_version: str - """ - super().__init__(**kwargs) - self.target_version = target_version - - class Resource(_serialization.Model): """Common fields that are returned in the response for all Azure Resource Manager resources. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.connectedvmware.models.SystemData """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None self.name = None self.type = None + self.system_data = None class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.connectedvmware.models.SystemData """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "system_data": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) @@ -879,20 +826,24 @@ class GuestAgent(ProxyResource): # pylint: disable=too-many-instance-attributes Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: The system data. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.connectedvmware.models.SystemData :ivar uuid: Gets or sets a unique identifier for this resource. :vartype uuid: str :ivar credentials: Username / Password Credentials to provision guest agent. :vartype credentials: ~azure.mgmt.connectedvmware.models.GuestCredential + :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 :ivar http_proxy_config: HTTP Proxy configuration for the VM. :vartype http_proxy_config: ~azure.mgmt.connectedvmware.models.HttpProxyConfiguration :ivar provisioning_action: Gets or sets the guest agent provisioning action. Known values are: @@ -904,8 +855,9 @@ class GuestAgent(ProxyResource): # pylint: disable=too-many-instance-attributes :vartype custom_resource_name: str :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.connectedvmware.models.ResourceStatus] - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState """ _validation = { @@ -927,6 +879,7 @@ class GuestAgent(ProxyResource): # pylint: disable=too-many-instance-attributes "system_data": {"key": "systemData", "type": "SystemData"}, "uuid": {"key": "properties.uuid", "type": "str"}, "credentials": {"key": "properties.credentials", "type": "GuestCredential"}, + "private_link_scope_resource_id": {"key": "properties.privateLinkScopeResourceId", "type": "str"}, "http_proxy_config": {"key": "properties.httpProxyConfig", "type": "HttpProxyConfiguration"}, "provisioning_action": {"key": "properties.provisioningAction", "type": "str"}, "status": {"key": "properties.status", "type": "str"}, @@ -939,13 +892,17 @@ def __init__( self, *, credentials: Optional["_models.GuestCredential"] = None, + private_link_scope_resource_id: Optional[str] = None, http_proxy_config: Optional["_models.HttpProxyConfiguration"] = None, provisioning_action: Optional[Union[str, "_models.ProvisioningAction"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword credentials: Username / Password Credentials to provision guest agent. :paramtype credentials: ~azure.mgmt.connectedvmware.models.GuestCredential + :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 :keyword http_proxy_config: HTTP Proxy configuration for the VM. :paramtype http_proxy_config: ~azure.mgmt.connectedvmware.models.HttpProxyConfiguration :keyword provisioning_action: Gets or sets the guest agent provisioning action. Known values @@ -953,9 +910,9 @@ def __init__( :paramtype provisioning_action: str or ~azure.mgmt.connectedvmware.models.ProvisioningAction """ super().__init__(**kwargs) - self.system_data = None self.uuid = None self.credentials = credentials + self.private_link_scope_resource_id = private_link_scope_resource_id self.http_proxy_config = http_proxy_config self.provisioning_action = provisioning_action self.status = None @@ -984,7 +941,7 @@ class GuestAgentList(_serialization.Model): "value": {"key": "value", "type": "[GuestAgent]"}, } - def __init__(self, *, value: List["_models.GuestAgent"], next_link: Optional[str] = None, **kwargs): + def __init__(self, *, value: List["_models.GuestAgent"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: Url to follow for getting next page of GuestAgent. :paramtype next_link: str @@ -996,86 +953,6 @@ def __init__(self, *, value: List["_models.GuestAgent"], next_link: Optional[str self.value = value -class GuestAgentProfile(_serialization.Model): - """Specifies the guest agent settings for the virtual machine. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar vm_uuid: Specifies the VM's unique SMBIOS ID. - :vartype vm_uuid: str - :ivar status: The status of the hybrid machine agent. Known values are: "Connected", - "Disconnected", and "Error". - :vartype status: str or ~azure.mgmt.connectedvmware.models.StatusTypes - :ivar last_status_change: The time of the last status change. - :vartype last_status_change: ~datetime.datetime - :ivar client_public_key: Gets or sets the Public Key provided by the client for enabling guest - management. - :vartype client_public_key: str - :ivar mssql_discovered: Specifies whether any MS SQL instance is discovered on the machine. - :vartype mssql_discovered: str - :ivar agent_version: The hybrid machine agent full version. - :vartype agent_version: str - :ivar error_details: Details about the error state. - :vartype error_details: list[~azure.mgmt.connectedvmware.models.ErrorDetail] - """ - - _validation = { - "vm_uuid": {"readonly": True}, - "status": {"readonly": True}, - "last_status_change": {"readonly": True}, - "mssql_discovered": {"readonly": True}, - "agent_version": {"readonly": True}, - "error_details": {"readonly": True}, - } - - _attribute_map = { - "vm_uuid": {"key": "vmUuid", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "last_status_change": {"key": "lastStatusChange", "type": "iso-8601"}, - "client_public_key": {"key": "clientPublicKey", "type": "str"}, - "mssql_discovered": {"key": "mssqlDiscovered", "type": "str"}, - "agent_version": {"key": "agentVersion", "type": "str"}, - "error_details": {"key": "errorDetails", "type": "[ErrorDetail]"}, - } - - def __init__(self, *, client_public_key: Optional[str] = None, **kwargs): - """ - :keyword client_public_key: Gets or sets the Public Key provided by the client for enabling - guest management. - :paramtype client_public_key: str - """ - super().__init__(**kwargs) - self.vm_uuid = None - self.status = None - self.last_status_change = None - self.client_public_key = client_public_key - self.mssql_discovered = None - self.agent_version = None - self.error_details = None - - -class GuestAgentProfileUpdate(_serialization.Model): - """Specifies the guest agent settings for the virtual machine. - - :ivar client_public_key: Gets or sets the Public Key provided by the client for enabling guest - management. - :vartype client_public_key: str - """ - - _attribute_map = { - "client_public_key": {"key": "clientPublicKey", "type": "str"}, - } - - def __init__(self, *, client_public_key: Optional[str] = None, **kwargs): - """ - :keyword client_public_key: Gets or sets the Public Key provided by the client for enabling - guest management. - :paramtype client_public_key: str - """ - super().__init__(**kwargs) - self.client_public_key = client_public_key - - class GuestCredential(_serialization.Model): """Username / Password Credentials to connect to guest. @@ -1090,7 +967,7 @@ class GuestCredential(_serialization.Model): "password": {"key": "password", "type": "str"}, } - def __init__(self, *, username: Optional[str] = None, password: Optional[str] = None, **kwargs): + def __init__(self, *, username: Optional[str] = None, password: Optional[str] = None, **kwargs: Any) -> None: """ :keyword username: Gets or sets username to connect with the guest. :paramtype username: str @@ -1146,8 +1023,8 @@ def __init__( memory_size_mb: Optional[int] = None, num_cp_us: Optional[int] = None, num_cores_per_socket: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword memory_size_mb: Gets or sets memory size in MBs for the vm. :paramtype memory_size_mb: int @@ -1205,12 +1082,21 @@ class Host(_serialization.Model): # pylint: disable=too-many-instance-attribute :vartype statuses: list[~azure.mgmt.connectedvmware.models.ResourceStatus] :ivar custom_resource_name: Gets the name of the corresponding resource in Kubernetes. :vartype custom_resource_name: str - :ivar datastore_ids: Gets or sets the datastore ARM ids. + :ivar overall_memory_usage_gb: Gets the used physical memory on the host in GB. + :vartype overall_memory_usage_gb: int + :ivar memory_size_gb: Gets the total amount of physical memory on the host in GB. + :vartype memory_size_gb: int + :ivar overall_cpu_usage_m_hz: Gets the used CPU usage across all cores in MHz. + :vartype overall_cpu_usage_m_hz: int + :ivar cpu_mhz: Gets the max CPU usage across all cores in MHz. + :vartype cpu_mhz: int + :ivar datastore_ids: Gets the datastore ARM ids. :vartype datastore_ids: list[str] - :ivar network_ids: Gets or sets the network ARM ids. + :ivar network_ids: Gets the network ARM ids. :vartype network_ids: list[str] - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState """ _validation = { @@ -1223,6 +1109,10 @@ class Host(_serialization.Model): # pylint: disable=too-many-instance-attribute "mo_name": {"readonly": True}, "statuses": {"readonly": True}, "custom_resource_name": {"readonly": True}, + "overall_memory_usage_gb": {"readonly": True}, + "memory_size_gb": {"readonly": True}, + "overall_cpu_usage_m_hz": {"readonly": True}, + "cpu_mhz": {"readonly": True}, "datastore_ids": {"readonly": True}, "network_ids": {"readonly": True}, "provisioning_state": {"readonly": True}, @@ -1244,6 +1134,10 @@ class Host(_serialization.Model): # pylint: disable=too-many-instance-attribute "mo_name": {"key": "properties.moName", "type": "str"}, "statuses": {"key": "properties.statuses", "type": "[ResourceStatus]"}, "custom_resource_name": {"key": "properties.customResourceName", "type": "str"}, + "overall_memory_usage_gb": {"key": "properties.overallMemoryUsageGB", "type": "int"}, + "memory_size_gb": {"key": "properties.memorySizeGB", "type": "int"}, + "overall_cpu_usage_m_hz": {"key": "properties.overallCpuUsageMHz", "type": "int"}, + "cpu_mhz": {"key": "properties.cpuMhz", "type": "int"}, "datastore_ids": {"key": "properties.datastoreIds", "type": "[str]"}, "network_ids": {"key": "properties.networkIds", "type": "[str]"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, @@ -1259,8 +1153,8 @@ def __init__( v_center_id: Optional[str] = None, mo_ref_id: Optional[str] = None, inventory_item_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Gets or sets the location. Required. :paramtype location: str @@ -1296,6 +1190,10 @@ def __init__( self.mo_name = None self.statuses = None self.custom_resource_name = None + self.overall_memory_usage_gb = None + self.memory_size_gb = None + self.overall_cpu_usage_m_hz = None + self.cpu_mhz = None self.datastore_ids = None self.network_ids = None self.provisioning_state = None @@ -1319,8 +1217,9 @@ class HostInventoryItem(InventoryItemProperties): :vartype mo_ref_id: str :ivar mo_name: Gets or sets the vCenter Managed Object name for the inventory item. :vartype mo_name: str - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState :ivar parent: Parent host inventory resource details. :vartype parent: ~azure.mgmt.connectedvmware.models.InventoryItemDetails """ @@ -1346,8 +1245,8 @@ def __init__( mo_ref_id: Optional[str] = None, mo_name: Optional[str] = None, parent: Optional["_models.InventoryItemDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword managed_resource_id: Gets or sets the tracked resource id corresponding to the inventory resource. @@ -1385,7 +1284,7 @@ class HostsList(_serialization.Model): "value": {"key": "value", "type": "[Host]"}, } - def __init__(self, *, value: List["_models.Host"], next_link: Optional[str] = None, **kwargs): + def __init__(self, *, value: List["_models.Host"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: Url to follow for getting next page of Hosts. :paramtype next_link: str @@ -1408,7 +1307,7 @@ class HttpProxyConfiguration(_serialization.Model): "https_proxy": {"key": "httpsProxy", "type": "str"}, } - def __init__(self, *, https_proxy: Optional[str] = None, **kwargs): + def __init__(self, *, https_proxy: Optional[str] = None, **kwargs: Any) -> None: """ :keyword https_proxy: Gets or sets httpsProxy url. :paramtype https_proxy: str @@ -1417,136 +1316,92 @@ def __init__(self, *, https_proxy: Optional[str] = None, **kwargs): self.https_proxy = https_proxy -class HybridIdentityMetadata(ProxyResource): - """Defines the HybridIdentityMetadata. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: The system data. - :vartype system_data: ~azure.mgmt.connectedvmware.models.SystemData - :ivar vm_id: Gets or sets the Vm Id. - :vartype vm_id: str - :ivar public_key: Gets or sets the Public Key. - :vartype public_key: str - :ivar identity: The identity of the resource. - :vartype identity: ~azure.mgmt.connectedvmware.models.Identity - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "identity": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "vm_id": {"key": "properties.vmId", "type": "str"}, - "public_key": {"key": "properties.publicKey", "type": "str"}, - "identity": {"key": "properties.identity", "type": "Identity"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__(self, *, vm_id: Optional[str] = None, public_key: Optional[str] = None, **kwargs): - """ - :keyword vm_id: Gets or sets the Vm Id. - :paramtype vm_id: str - :keyword public_key: Gets or sets the Public Key. - :paramtype public_key: str - """ - super().__init__(**kwargs) - self.system_data = None - self.vm_id = vm_id - self.public_key = public_key - self.identity = None - self.provisioning_state = None - - -class HybridIdentityMetadataList(_serialization.Model): - """List of HybridIdentityMetadata. - - All required parameters must be populated in order to send to Azure. - - :ivar next_link: Url to follow for getting next page of HybridIdentityMetadata. - :vartype next_link: str - :ivar value: Array of HybridIdentityMetadata. Required. - :vartype value: list[~azure.mgmt.connectedvmware.models.HybridIdentityMetadata] - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[HybridIdentityMetadata]"}, - } - - def __init__(self, *, value: List["_models.HybridIdentityMetadata"], next_link: Optional[str] = None, **kwargs): - """ - :keyword next_link: Url to follow for getting next page of HybridIdentityMetadata. - :paramtype next_link: str - :keyword value: Array of HybridIdentityMetadata. Required. - :paramtype value: list[~azure.mgmt.connectedvmware.models.HybridIdentityMetadata] - """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = value - - -class Identity(_serialization.Model): - """Managed service identity. +class InfrastructureProfile(_serialization.Model): + """Specifies the vCenter infrastructure specific settings for the virtual machine. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - - :ivar principal_id: The principal id of managed service identity. - :vartype principal_id: str - :ivar tenant_id: The tenant of managed service identity. - :vartype tenant_id: str - :ivar type: The type of managed service identity. Required. Known values are: "None" and - "SystemAssigned". - :vartype type: str or ~azure.mgmt.connectedvmware.models.IdentityType + :ivar template_id: Gets or sets the ARM Id of the template resource to deploy the virtual + machine. + :vartype template_id: str + :ivar v_center_id: Gets or sets the ARM Id of the vCenter resource in which this resource pool + resides. + :vartype v_center_id: str + :ivar mo_ref_id: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the virtual + machine. + :vartype mo_ref_id: str + :ivar inventory_item_id: Gets or sets the inventory Item ID for the virtual machine. + :vartype inventory_item_id: str + :ivar mo_name: Gets or sets the vCenter Managed Object name for the virtual machine. + :vartype mo_name: str + :ivar folder_path: Gets or sets the folder path of the vm. + :vartype folder_path: str + :ivar instance_uuid: Gets or sets the instance uuid of the vm. + :vartype instance_uuid: str + :ivar smbios_uuid: Gets or sets the SMBIOS UUID of the vm. + :vartype smbios_uuid: str + :ivar firmware_type: Firmware type. Known values are: "bios" and "efi". + :vartype firmware_type: str or ~azure.mgmt.connectedvmware.models.FirmwareType + :ivar custom_resource_name: Gets the name of the corresponding resource in Kubernetes. + :vartype custom_resource_name: str """ _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - "type": {"required": True}, + "mo_ref_id": {"readonly": True}, + "mo_name": {"readonly": True}, + "folder_path": {"readonly": True}, + "instance_uuid": {"readonly": True}, + "custom_resource_name": {"readonly": True}, } _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "type": {"key": "type", "type": "str"}, + "template_id": {"key": "templateId", "type": "str"}, + "v_center_id": {"key": "vCenterId", "type": "str"}, + "mo_ref_id": {"key": "moRefId", "type": "str"}, + "inventory_item_id": {"key": "inventoryItemId", "type": "str"}, + "mo_name": {"key": "moName", "type": "str"}, + "folder_path": {"key": "folderPath", "type": "str"}, + "instance_uuid": {"key": "instanceUuid", "type": "str"}, + "smbios_uuid": {"key": "smbiosUuid", "type": "str"}, + "firmware_type": {"key": "firmwareType", "type": "str"}, + "custom_resource_name": {"key": "customResourceName", "type": "str"}, } - def __init__(self, *, type: Union[str, "_models.IdentityType"], **kwargs): + def __init__( + self, + *, + template_id: Optional[str] = None, + v_center_id: Optional[str] = None, + inventory_item_id: Optional[str] = None, + smbios_uuid: Optional[str] = None, + firmware_type: Optional[Union[str, "_models.FirmwareType"]] = None, + **kwargs: Any + ) -> None: """ - :keyword type: The type of managed service identity. Required. Known values are: "None" and - "SystemAssigned". - :paramtype type: str or ~azure.mgmt.connectedvmware.models.IdentityType + :keyword template_id: Gets or sets the ARM Id of the template resource to deploy the virtual + machine. + :paramtype template_id: str + :keyword v_center_id: Gets or sets the ARM Id of the vCenter resource in which this resource + pool resides. + :paramtype v_center_id: str + :keyword inventory_item_id: Gets or sets the inventory Item ID for the virtual machine. + :paramtype inventory_item_id: str + :keyword smbios_uuid: Gets or sets the SMBIOS UUID of the vm. + :paramtype smbios_uuid: str + :keyword firmware_type: Firmware type. Known values are: "bios" and "efi". + :paramtype firmware_type: str or ~azure.mgmt.connectedvmware.models.FirmwareType """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = type + self.template_id = template_id + self.v_center_id = v_center_id + self.mo_ref_id = None + self.inventory_item_id = inventory_item_id + self.mo_name = None + self.folder_path = None + self.instance_uuid = None + self.smbios_uuid = smbios_uuid + self.firmware_type = firmware_type + self.custom_resource_name = None class InventoryItem(ProxyResource): @@ -1556,15 +1411,16 @@ class InventoryItem(ProxyResource): All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: The system data. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. :vartype system_data: ~azure.mgmt.connectedvmware.models.SystemData :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, @@ -1581,8 +1437,9 @@ class InventoryItem(ProxyResource): :vartype mo_ref_id: str :ivar mo_name: Gets or sets the vCenter Managed Object name for the inventory item. :vartype mo_name: str - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState """ _validation = { @@ -1614,8 +1471,8 @@ def __init__( managed_resource_id: Optional[str] = None, mo_ref_id: Optional[str] = None, mo_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword kind: Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, @@ -1631,7 +1488,6 @@ def __init__( :paramtype mo_name: str """ super().__init__(**kwargs) - self.system_data = None self.kind = kind self.inventory_type: Optional[str] = None self.managed_resource_id = managed_resource_id @@ -1664,8 +1520,8 @@ def __init__( inventory_item_id: Optional[str] = None, mo_name: Optional[str] = None, inventory_type: Optional[Union[str, "_models.InventoryType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword inventory_item_id: Gets or sets the inventory Item ID for the resource. :paramtype inventory_item_id: str @@ -1702,7 +1558,7 @@ class InventoryItemsList(_serialization.Model): "value": {"key": "value", "type": "[InventoryItem]"}, } - def __init__(self, *, value: List["_models.InventoryItem"], next_link: Optional[str] = None, **kwargs): + def __init__(self, *, value: List["_models.InventoryItem"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: Url to follow for getting next page of InventoryItems. :paramtype next_link: str @@ -1714,515 +1570,48 @@ def __init__(self, *, value: List["_models.InventoryItem"], next_link: Optional[ self.value = value -class LinuxParameters(_serialization.Model): - """Input for InstallPatches on a Linux VM, as directly received by the API. +class NetworkInterface(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Network Interface model. + + Variables are only populated by the server, and will be ignored when sending a request. - :ivar classifications_to_include: The update classifications to select when installing patches - for Linux. - :vartype classifications_to_include: list[str or - ~azure.mgmt.connectedvmware.models.VMGuestPatchClassificationLinux] - :ivar package_name_masks_to_include: packages to include in the patch operation. Format: - packageName_packageVersion. - :vartype package_name_masks_to_include: list[str] - :ivar package_name_masks_to_exclude: packages to exclude in the patch operation. Format: - packageName_packageVersion. - :vartype package_name_masks_to_exclude: list[str] + :ivar name: Gets or sets the name of the network interface. + :vartype name: str + :ivar label: Gets or sets the label of the virtual network in vCenter that the nic is connected + to. + :vartype label: str + :ivar ip_addresses: Gets or sets the nic ip addresses. + :vartype ip_addresses: list[str] + :ivar mac_address: Gets or sets the NIC MAC address. + :vartype mac_address: str + :ivar network_id: Gets or sets the ARM Id of the network resource to connect the virtual + machine. + :vartype network_id: str + :ivar nic_type: NIC type. Known values are: "vmxnet3", "vmxnet2", "vmxnet", "e1000", "e1000e", + and "pcnet32". + :vartype nic_type: str or ~azure.mgmt.connectedvmware.models.NICType + :ivar power_on_boot: Gets or sets the power on boot. Known values are: "enabled" and + "disabled". + :vartype power_on_boot: str or ~azure.mgmt.connectedvmware.models.PowerOnBootOption + :ivar network_mo_ref_id: Gets or sets the vCenter MoRef (Managed Object Reference) ID of the + virtual network + that the nic is connected to. + :vartype network_mo_ref_id: str + :ivar network_mo_name: Gets or sets the name of the virtual network in vCenter that the nic is + connected to. + :vartype network_mo_name: str + :ivar device_key: Gets or sets the device key value. + :vartype device_key: int + :ivar ip_settings: Gets or sets the ipsettings. + :vartype ip_settings: ~azure.mgmt.connectedvmware.models.NicIPSettings """ - _attribute_map = { - "classifications_to_include": {"key": "classificationsToInclude", "type": "[str]"}, - "package_name_masks_to_include": {"key": "packageNameMasksToInclude", "type": "[str]"}, - "package_name_masks_to_exclude": {"key": "packageNameMasksToExclude", "type": "[str]"}, - } - - def __init__( - self, - *, - classifications_to_include: Optional[List[Union[str, "_models.VMGuestPatchClassificationLinux"]]] = None, - package_name_masks_to_include: Optional[List[str]] = None, - package_name_masks_to_exclude: Optional[List[str]] = None, - **kwargs - ): - """ - :keyword classifications_to_include: The update classifications to select when installing - patches for Linux. - :paramtype classifications_to_include: list[str or - ~azure.mgmt.connectedvmware.models.VMGuestPatchClassificationLinux] - :keyword package_name_masks_to_include: packages to include in the patch operation. Format: - packageName_packageVersion. - :paramtype package_name_masks_to_include: list[str] - :keyword package_name_masks_to_exclude: packages to exclude in the patch operation. Format: - packageName_packageVersion. - :paramtype package_name_masks_to_exclude: list[str] - """ - super().__init__(**kwargs) - self.classifications_to_include = classifications_to_include - self.package_name_masks_to_include = package_name_masks_to_include - self.package_name_masks_to_exclude = package_name_masks_to_exclude - - -class MachineExtension(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Describes a Machine Extension. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar location: Gets or sets the location. - :vartype location: str - :ivar system_data: The system data. - :vartype system_data: ~azure.mgmt.connectedvmware.models.SystemData - :ivar tags: Gets or sets the Resource tags. - :vartype tags: dict[str, str] - :ivar name: Gets or sets the name. - :vartype name: str - :ivar id: Gets or sets the Id. - :vartype id: str - :ivar type: Gets or sets the type of the resource. - :vartype type: str - :ivar force_update_tag: How the extension handler should be forced to update even if the - extension configuration has not changed. - :vartype force_update_tag: str - :ivar publisher: The name of the extension handler publisher. - :vartype publisher: str - :ivar type_properties_type: Specifies the type of the extension; an example is - "CustomScriptExtension". - :vartype type_properties_type: str - :ivar type_handler_version: Specifies the version of the script handler. - :vartype type_handler_version: str - :ivar enable_automatic_upgrade: Indicates whether the extension should be automatically - upgraded by the platform if there is a newer version available. - :vartype enable_automatic_upgrade: bool - :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor - version if one is available at deployment time. Once deployed, however, the extension will not - upgrade minor versions unless redeployed, even with this property set to true. - :vartype auto_upgrade_minor_version: bool - :ivar settings: Json formatted public settings for the extension. - :vartype settings: JSON - :ivar protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :vartype protected_settings: JSON - :ivar provisioning_state: The provisioning state, which only appears in the response. - :vartype provisioning_state: str - :ivar instance_view: The machine extension instance view. - :vartype instance_view: - ~azure.mgmt.connectedvmware.models.MachineExtensionPropertiesInstanceView - """ - - _validation = { - "system_data": {"readonly": True}, - "name": {"readonly": True}, - "id": {"readonly": True}, - "type": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "location": {"key": "location", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "name": {"key": "name", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "force_update_tag": {"key": "properties.forceUpdateTag", "type": "str"}, - "publisher": {"key": "properties.publisher", "type": "str"}, - "type_properties_type": {"key": "properties.type", "type": "str"}, - "type_handler_version": {"key": "properties.typeHandlerVersion", "type": "str"}, - "enable_automatic_upgrade": {"key": "properties.enableAutomaticUpgrade", "type": "bool"}, - "auto_upgrade_minor_version": {"key": "properties.autoUpgradeMinorVersion", "type": "bool"}, - "settings": {"key": "properties.settings", "type": "object"}, - "protected_settings": {"key": "properties.protectedSettings", "type": "object"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "instance_view": {"key": "properties.instanceView", "type": "MachineExtensionPropertiesInstanceView"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - force_update_tag: Optional[str] = None, - publisher: Optional[str] = None, - type_properties_type: Optional[str] = None, - type_handler_version: Optional[str] = None, - enable_automatic_upgrade: Optional[bool] = None, - auto_upgrade_minor_version: Optional[bool] = None, - settings: Optional[JSON] = None, - protected_settings: Optional[JSON] = None, - instance_view: Optional["_models.MachineExtensionPropertiesInstanceView"] = None, - **kwargs - ): - """ - :keyword location: Gets or sets the location. - :paramtype location: str - :keyword tags: Gets or sets the Resource tags. - :paramtype tags: dict[str, str] - :keyword force_update_tag: How the extension handler should be forced to update even if the - extension configuration has not changed. - :paramtype force_update_tag: str - :keyword publisher: The name of the extension handler publisher. - :paramtype publisher: str - :keyword type_properties_type: Specifies the type of the extension; an example is - "CustomScriptExtension". - :paramtype type_properties_type: str - :keyword type_handler_version: Specifies the version of the script handler. - :paramtype type_handler_version: str - :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically - upgraded by the platform if there is a newer version available. - :paramtype enable_automatic_upgrade: bool - :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor - version if one is available at deployment time. Once deployed, however, the extension will not - upgrade minor versions unless redeployed, even with this property set to true. - :paramtype auto_upgrade_minor_version: bool - :keyword settings: Json formatted public settings for the extension. - :paramtype settings: JSON - :keyword protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :paramtype protected_settings: JSON - :keyword instance_view: The machine extension instance view. - :paramtype instance_view: - ~azure.mgmt.connectedvmware.models.MachineExtensionPropertiesInstanceView - """ - super().__init__(**kwargs) - self.location = location - self.system_data = None - self.tags = tags - self.name = None - self.id = None - self.type = None - self.force_update_tag = force_update_tag - self.publisher = publisher - self.type_properties_type = type_properties_type - self.type_handler_version = type_handler_version - self.enable_automatic_upgrade = enable_automatic_upgrade - self.auto_upgrade_minor_version = auto_upgrade_minor_version - self.settings = settings - self.protected_settings = protected_settings - self.provisioning_state = None - self.instance_view = instance_view - - -class MachineExtensionInstanceView(_serialization.Model): - """Describes the Machine Extension Instance View. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The machine extension name. - :vartype name: str - :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". - :vartype type: str - :ivar type_handler_version: Specifies the version of the script handler. - :vartype type_handler_version: str - :ivar status: Instance view status. - :vartype status: ~azure.mgmt.connectedvmware.models.MachineExtensionInstanceViewStatus - """ - - _validation = { - "name": {"readonly": True}, - "type": {"readonly": True}, - "type_handler_version": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "type_handler_version": {"key": "typeHandlerVersion", "type": "str"}, - "status": {"key": "status", "type": "MachineExtensionInstanceViewStatus"}, - } - - def __init__(self, *, status: Optional["_models.MachineExtensionInstanceViewStatus"] = None, **kwargs): - """ - :keyword status: Instance view status. - :paramtype status: ~azure.mgmt.connectedvmware.models.MachineExtensionInstanceViewStatus - """ - super().__init__(**kwargs) - self.name = None - self.type = None - self.type_handler_version = None - self.status = status - - -class MachineExtensionInstanceViewStatus(_serialization.Model): - """Instance view status. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The status code. - :vartype code: str - :ivar level: The level code. Known values are: "Info", "Warning", and "Error". - :vartype level: str or ~azure.mgmt.connectedvmware.models.StatusLevelTypes - :ivar display_status: The short localizable label for the status. - :vartype display_status: str - :ivar message: The detailed status message, including for alerts and error messages. - :vartype message: str - :ivar time: The time of the status. - :vartype time: ~datetime.datetime - """ - - _validation = { - "code": {"readonly": True}, - "level": {"readonly": True}, - "display_status": {"readonly": True}, - "message": {"readonly": True}, - "time": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "level": {"key": "level", "type": "str"}, - "display_status": {"key": "displayStatus", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "time": {"key": "time", "type": "iso-8601"}, - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.code = None - self.level = None - self.display_status = None - self.message = None - self.time = None - - -class MachineExtensionPropertiesInstanceView(MachineExtensionInstanceView): - """The machine extension instance view. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The machine extension name. - :vartype name: str - :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". - :vartype type: str - :ivar type_handler_version: Specifies the version of the script handler. - :vartype type_handler_version: str - :ivar status: Instance view status. - :vartype status: ~azure.mgmt.connectedvmware.models.MachineExtensionInstanceViewStatus - """ - - _validation = { - "name": {"readonly": True}, - "type": {"readonly": True}, - "type_handler_version": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "type_handler_version": {"key": "typeHandlerVersion", "type": "str"}, - "status": {"key": "status", "type": "MachineExtensionInstanceViewStatus"}, - } - - def __init__(self, *, status: Optional["_models.MachineExtensionInstanceViewStatus"] = None, **kwargs): - """ - :keyword status: Instance view status. - :paramtype status: ~azure.mgmt.connectedvmware.models.MachineExtensionInstanceViewStatus - """ - super().__init__(status=status, **kwargs) - - -class MachineExtensionsListResult(_serialization.Model): - """Describes the Machine Extensions List Result. - - :ivar value: The list of extensions. - :vartype value: list[~azure.mgmt.connectedvmware.models.MachineExtension] - :ivar next_link: The uri to fetch the next page of machine extensions. Call ListNext() with - this to fetch the next page of extensions. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[MachineExtension]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.MachineExtension"]] = None, next_link: Optional[str] = None, **kwargs - ): - """ - :keyword value: The list of extensions. - :paramtype value: list[~azure.mgmt.connectedvmware.models.MachineExtension] - :keyword next_link: The uri to fetch the next page of machine extensions. Call ListNext() with - this to fetch the next page of extensions. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ResourcePatch(_serialization.Model): - """Object containing updates for patch operations. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class MachineExtensionUpdate(ResourcePatch): - """Describes a Machine Extension Update. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar force_update_tag: How the extension handler should be forced to update even if the - extension configuration has not changed. - :vartype force_update_tag: str - :ivar publisher: The name of the extension handler publisher. - :vartype publisher: str - :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". - :vartype type: str - :ivar type_handler_version: Specifies the version of the script handler. - :vartype type_handler_version: str - :ivar enable_automatic_upgrade: Indicates whether the extension should be automatically - upgraded by the platform if there is a newer version available. - :vartype enable_automatic_upgrade: bool - :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor - version if one is available at deployment time. Once deployed, however, the extension will not - upgrade minor versions unless redeployed, even with this property set to true. - :vartype auto_upgrade_minor_version: bool - :ivar settings: Json formatted public settings for the extension. - :vartype settings: JSON - :ivar protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :vartype protected_settings: JSON - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "force_update_tag": {"key": "properties.forceUpdateTag", "type": "str"}, - "publisher": {"key": "properties.publisher", "type": "str"}, - "type": {"key": "properties.type", "type": "str"}, - "type_handler_version": {"key": "properties.typeHandlerVersion", "type": "str"}, - "enable_automatic_upgrade": {"key": "properties.enableAutomaticUpgrade", "type": "bool"}, - "auto_upgrade_minor_version": {"key": "properties.autoUpgradeMinorVersion", "type": "bool"}, - "settings": {"key": "properties.settings", "type": "object"}, - "protected_settings": {"key": "properties.protectedSettings", "type": "object"}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - force_update_tag: Optional[str] = None, - publisher: Optional[str] = None, - type: Optional[str] = None, - type_handler_version: Optional[str] = None, - enable_automatic_upgrade: Optional[bool] = None, - auto_upgrade_minor_version: Optional[bool] = None, - settings: Optional[JSON] = None, - protected_settings: Optional[JSON] = None, - **kwargs - ): - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword force_update_tag: How the extension handler should be forced to update even if the - extension configuration has not changed. - :paramtype force_update_tag: str - :keyword publisher: The name of the extension handler publisher. - :paramtype publisher: str - :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". - :paramtype type: str - :keyword type_handler_version: Specifies the version of the script handler. - :paramtype type_handler_version: str - :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically - upgraded by the platform if there is a newer version available. - :paramtype enable_automatic_upgrade: bool - :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor - version if one is available at deployment time. Once deployed, however, the extension will not - upgrade minor versions unless redeployed, even with this property set to true. - :paramtype auto_upgrade_minor_version: bool - :keyword settings: Json formatted public settings for the extension. - :paramtype settings: JSON - :keyword protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :paramtype protected_settings: JSON - """ - super().__init__(tags=tags, **kwargs) - self.force_update_tag = force_update_tag - self.publisher = publisher - self.type = type - self.type_handler_version = type_handler_version - self.enable_automatic_upgrade = enable_automatic_upgrade - self.auto_upgrade_minor_version = auto_upgrade_minor_version - self.settings = settings - self.protected_settings = protected_settings - - -class MachineExtensionUpgrade(_serialization.Model): - """Describes the Machine Extension Upgrade Properties. - - :ivar extension_targets: Describes the Extension Target Properties. - :vartype extension_targets: dict[str, - ~azure.mgmt.connectedvmware.models.ExtensionTargetProperties] - """ - - _attribute_map = { - "extension_targets": {"key": "extensionTargets", "type": "{ExtensionTargetProperties}"}, - } - - def __init__(self, *, extension_targets: Optional[Dict[str, "_models.ExtensionTargetProperties"]] = None, **kwargs): - """ - :keyword extension_targets: Describes the Extension Target Properties. - :paramtype extension_targets: dict[str, - ~azure.mgmt.connectedvmware.models.ExtensionTargetProperties] - """ - super().__init__(**kwargs) - self.extension_targets = extension_targets - - -class NetworkInterface(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Network Interface model. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Gets or sets the name of the network interface. - :vartype name: str - :ivar label: Gets or sets the label of the virtual network in vCenter that the nic is connected - to. - :vartype label: str - :ivar ip_addresses: Gets or sets the nic ip addresses. - :vartype ip_addresses: list[str] - :ivar mac_address: Gets or sets the NIC MAC address. - :vartype mac_address: str - :ivar network_id: Gets or sets the ARM Id of the network resource to connect the virtual - machine. - :vartype network_id: str - :ivar nic_type: NIC type. Known values are: "vmxnet3", "vmxnet2", "vmxnet", "e1000", "e1000e", - and "pcnet32". - :vartype nic_type: str or ~azure.mgmt.connectedvmware.models.NICType - :ivar power_on_boot: Gets or sets the power on boot. Known values are: "enabled" and - "disabled". - :vartype power_on_boot: str or ~azure.mgmt.connectedvmware.models.PowerOnBootOption - :ivar network_mo_ref_id: Gets or sets the vCenter MoRef (Managed Object Reference) ID of the - virtual network - that the nic is connected to. - :vartype network_mo_ref_id: str - :ivar network_mo_name: Gets or sets the name of the virtual network in vCenter that the nic is - connected to. - :vartype network_mo_name: str - :ivar device_key: Gets or sets the device key value. - :vartype device_key: int - :ivar ip_settings: Gets or sets the ipsettings. - :vartype ip_settings: ~azure.mgmt.connectedvmware.models.NicIPSettings - """ - - _validation = { - "label": {"readonly": True}, - "ip_addresses": {"readonly": True}, - "mac_address": {"readonly": True}, - "network_mo_ref_id": {"readonly": True}, - "network_mo_name": {"readonly": True}, + _validation = { + "label": {"readonly": True}, + "ip_addresses": {"readonly": True}, + "mac_address": {"readonly": True}, + "network_mo_ref_id": {"readonly": True}, + "network_mo_name": {"readonly": True}, } _attribute_map = { @@ -2248,8 +1637,8 @@ def __init__( power_on_boot: Optional[Union[str, "_models.PowerOnBootOption"]] = None, device_key: Optional[int] = None, ip_settings: Optional["_models.NicIPSettings"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the network interface. :paramtype name: str @@ -2315,8 +1704,8 @@ def __init__( nic_type: Optional[Union[str, "_models.NICType"]] = None, power_on_boot: Optional[Union[str, "_models.PowerOnBootOption"]] = None, device_key: Optional[int] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the network interface. :paramtype name: str @@ -2352,7 +1741,7 @@ class NetworkProfile(_serialization.Model): "network_interfaces": {"key": "networkInterfaces", "type": "[NetworkInterface]"}, } - def __init__(self, *, network_interfaces: Optional[List["_models.NetworkInterface"]] = None, **kwargs): + def __init__(self, *, network_interfaces: Optional[List["_models.NetworkInterface"]] = None, **kwargs: Any) -> None: """ :keyword network_interfaces: Gets or sets the list of network interfaces associated with the virtual machine. @@ -2374,7 +1763,9 @@ class NetworkProfileUpdate(_serialization.Model): "network_interfaces": {"key": "networkInterfaces", "type": "[NetworkInterfaceUpdate]"}, } - def __init__(self, *, network_interfaces: Optional[List["_models.NetworkInterfaceUpdate"]] = None, **kwargs): + def __init__( + self, *, network_interfaces: Optional[List["_models.NetworkInterfaceUpdate"]] = None, **kwargs: Any + ) -> None: """ :keyword network_interfaces: Gets or sets the list of network interfaces associated with the virtual machine. @@ -2409,7 +1800,7 @@ class NicIPAddressSettings(_serialization.Model): "subnet_mask": {"key": "subnetMask", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.allocation_method = None @@ -2467,8 +1858,8 @@ def __init__( gateway: Optional[List[str]] = None, ip_address: Optional[str] = None, subnet_mask: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword allocation_method: Gets or sets the nic allocation method. Known values are: "unset", "dynamic", "static", "linklayer", "random", and "other". @@ -2517,8 +1908,8 @@ def __init__( name: Optional[str] = None, is_data_action: Optional[bool] = None, display: Optional["_models.OperationDisplay"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Name of the operation. :paramtype name: str @@ -2560,8 +1951,8 @@ def __init__( resource: Optional[str] = None, operation: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Provider name. :paramtype provider: str @@ -2599,7 +1990,7 @@ class OperationsList(_serialization.Model): "value": {"key": "value", "type": "[Operation]"}, } - def __init__(self, *, value: List["_models.Operation"], next_link: Optional[str] = None, **kwargs): + def __init__(self, *, value: List["_models.Operation"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: Url to follow for getting next page of operations. :paramtype next_link: str @@ -2611,7 +2002,7 @@ def __init__(self, *, value: List["_models.Operation"], next_link: Optional[str] self.value = value -class OsProfile(_serialization.Model): # pylint: disable=too-many-instance-attributes +class OsProfileForVMInstance(_serialization.Model): """Specifies the operating system settings for the virtual machine. Variables are only populated by the server, and will be ignored when sending a request. @@ -2620,18 +2011,15 @@ class OsProfile(_serialization.Model): # pylint: disable=too-many-instance-attr :vartype computer_name: str :ivar admin_username: Gets or sets administrator username. :vartype admin_username: str - :ivar admin_password: Gets or sets administrator password. + :ivar admin_password: Sets administrator password. :vartype admin_password: str :ivar guest_id: Gets or sets the guestId. :vartype guest_id: str - :ivar allow_extension_operations: Gets or sets a value indicating whether the VM is ready for - extension operations. - :vartype allow_extension_operations: bool :ivar os_type: Gets or sets the type of the os. Known values are: "Windows", "Linux", and "Other". :vartype os_type: str or ~azure.mgmt.connectedvmware.models.OsType - :ivar os_name: Gets or sets os name. - :vartype os_name: str + :ivar os_sku: Gets or sets os sku. + :vartype os_sku: str :ivar tools_running_status: Gets or sets the current running status of VMware Tools running in the guest operating system. :vartype tools_running_status: str @@ -2640,16 +2028,10 @@ class OsProfile(_serialization.Model): # pylint: disable=too-many-instance-attr :vartype tools_version_status: str :ivar tools_version: Gets or sets the current version of VMware Tools. :vartype tools_version: str - :ivar windows_configuration: Specifies the windows configuration for update management. - :vartype windows_configuration: - ~azure.mgmt.connectedvmware.models.OsProfileWindowsConfiguration - :ivar linux_configuration: Specifies the linux configuration for update management. - :vartype linux_configuration: ~azure.mgmt.connectedvmware.models.OsProfileLinuxConfiguration """ _validation = { - "allow_extension_operations": {"readonly": True}, - "os_name": {"readonly": True}, + "os_sku": {"readonly": True}, "tools_running_status": {"readonly": True}, "tools_version_status": {"readonly": True}, "tools_version": {"readonly": True}, @@ -2660,14 +2042,11 @@ class OsProfile(_serialization.Model): # pylint: disable=too-many-instance-attr "admin_username": {"key": "adminUsername", "type": "str"}, "admin_password": {"key": "adminPassword", "type": "str"}, "guest_id": {"key": "guestId", "type": "str"}, - "allow_extension_operations": {"key": "allowExtensionOperations", "type": "bool"}, "os_type": {"key": "osType", "type": "str"}, - "os_name": {"key": "osName", "type": "str"}, + "os_sku": {"key": "osSku", "type": "str"}, "tools_running_status": {"key": "toolsRunningStatus", "type": "str"}, "tools_version_status": {"key": "toolsVersionStatus", "type": "str"}, "tools_version": {"key": "toolsVersion", "type": "str"}, - "windows_configuration": {"key": "windowsConfiguration", "type": "OsProfileWindowsConfiguration"}, - "linux_configuration": {"key": "linuxConfiguration", "type": "OsProfileLinuxConfiguration"}, } def __init__( @@ -2678,181 +2057,31 @@ def __init__( admin_password: Optional[str] = None, guest_id: Optional[str] = None, os_type: Optional[Union[str, "_models.OsType"]] = None, - windows_configuration: Optional["_models.OsProfileWindowsConfiguration"] = None, - linux_configuration: Optional["_models.OsProfileLinuxConfiguration"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword computer_name: Gets or sets computer name. :paramtype computer_name: str :keyword admin_username: Gets or sets administrator username. :paramtype admin_username: str - :keyword admin_password: Gets or sets administrator password. + :keyword admin_password: Sets administrator password. :paramtype admin_password: str :keyword guest_id: Gets or sets the guestId. :paramtype guest_id: str :keyword os_type: Gets or sets the type of the os. Known values are: "Windows", "Linux", and "Other". :paramtype os_type: str or ~azure.mgmt.connectedvmware.models.OsType - :keyword windows_configuration: Specifies the windows configuration for update management. - :paramtype windows_configuration: - ~azure.mgmt.connectedvmware.models.OsProfileWindowsConfiguration - :keyword linux_configuration: Specifies the linux configuration for update management. - :paramtype linux_configuration: ~azure.mgmt.connectedvmware.models.OsProfileLinuxConfiguration """ super().__init__(**kwargs) self.computer_name = computer_name self.admin_username = admin_username self.admin_password = admin_password self.guest_id = guest_id - self.allow_extension_operations = None self.os_type = os_type - self.os_name = None + self.os_sku = None self.tools_running_status = None self.tools_version_status = None self.tools_version = None - self.windows_configuration = windows_configuration - self.linux_configuration = linux_configuration - - -class OsProfileLinuxConfiguration(_serialization.Model): - """Specifies the linux configuration for update management. - - :ivar assessment_mode: Specifies the assessment mode. - :vartype assessment_mode: str - :ivar patch_mode: Specifies the patch mode. - :vartype patch_mode: str - """ - - _attribute_map = { - "assessment_mode": {"key": "patchSettings.assessmentMode", "type": "str"}, - "patch_mode": {"key": "patchSettings.patchMode", "type": "str"}, - } - - def __init__(self, *, assessment_mode: Optional[str] = None, patch_mode: Optional[str] = None, **kwargs): - """ - :keyword assessment_mode: Specifies the assessment mode. - :paramtype assessment_mode: str - :keyword patch_mode: Specifies the patch mode. - :paramtype patch_mode: str - """ - super().__init__(**kwargs) - self.assessment_mode = assessment_mode - self.patch_mode = patch_mode - - -class OsProfileUpdate(_serialization.Model): - """Specifies the operating system settings for the virtual machine. - - :ivar windows_configuration: Specifies the windows configuration for update management. - :vartype windows_configuration: - ~azure.mgmt.connectedvmware.models.OsProfileUpdateWindowsConfiguration - :ivar linux_configuration: Specifies the linux configuration for update management. - :vartype linux_configuration: - ~azure.mgmt.connectedvmware.models.OsProfileUpdateLinuxConfiguration - """ - - _attribute_map = { - "windows_configuration": {"key": "windowsConfiguration", "type": "OsProfileUpdateWindowsConfiguration"}, - "linux_configuration": {"key": "linuxConfiguration", "type": "OsProfileUpdateLinuxConfiguration"}, - } - - def __init__( - self, - *, - windows_configuration: Optional["_models.OsProfileUpdateWindowsConfiguration"] = None, - linux_configuration: Optional["_models.OsProfileUpdateLinuxConfiguration"] = None, - **kwargs - ): - """ - :keyword windows_configuration: Specifies the windows configuration for update management. - :paramtype windows_configuration: - ~azure.mgmt.connectedvmware.models.OsProfileUpdateWindowsConfiguration - :keyword linux_configuration: Specifies the linux configuration for update management. - :paramtype linux_configuration: - ~azure.mgmt.connectedvmware.models.OsProfileUpdateLinuxConfiguration - """ - super().__init__(**kwargs) - self.windows_configuration = windows_configuration - self.linux_configuration = linux_configuration - - -class OsProfileUpdateLinuxConfiguration(_serialization.Model): - """Specifies the linux configuration for update management. - - :ivar assessment_mode: Specifies the assessment mode. - :vartype assessment_mode: str - :ivar patch_mode: Specifies the patch mode. - :vartype patch_mode: str - """ - - _attribute_map = { - "assessment_mode": {"key": "patchSettings.assessmentMode", "type": "str"}, - "patch_mode": {"key": "patchSettings.patchMode", "type": "str"}, - } - - def __init__(self, *, assessment_mode: Optional[str] = None, patch_mode: Optional[str] = None, **kwargs): - """ - :keyword assessment_mode: Specifies the assessment mode. - :paramtype assessment_mode: str - :keyword patch_mode: Specifies the patch mode. - :paramtype patch_mode: str - """ - super().__init__(**kwargs) - self.assessment_mode = assessment_mode - self.patch_mode = patch_mode - - -class OsProfileUpdateWindowsConfiguration(_serialization.Model): - """Specifies the windows configuration for update management. - - :ivar assessment_mode: Specifies the assessment mode. - :vartype assessment_mode: str - :ivar patch_mode: Specifies the patch mode. - :vartype patch_mode: str - """ - - _attribute_map = { - "assessment_mode": {"key": "patchSettings.assessmentMode", "type": "str"}, - "patch_mode": {"key": "patchSettings.patchMode", "type": "str"}, - } - - def __init__(self, *, assessment_mode: Optional[str] = None, patch_mode: Optional[str] = None, **kwargs): - """ - :keyword assessment_mode: Specifies the assessment mode. - :paramtype assessment_mode: str - :keyword patch_mode: Specifies the patch mode. - :paramtype patch_mode: str - """ - super().__init__(**kwargs) - self.assessment_mode = assessment_mode - self.patch_mode = patch_mode - - -class OsProfileWindowsConfiguration(_serialization.Model): - """Specifies the windows configuration for update management. - - :ivar assessment_mode: Specifies the assessment mode. - :vartype assessment_mode: str - :ivar patch_mode: Specifies the patch mode. - :vartype patch_mode: str - """ - - _attribute_map = { - "assessment_mode": {"key": "patchSettings.assessmentMode", "type": "str"}, - "patch_mode": {"key": "patchSettings.patchMode", "type": "str"}, - } - - def __init__(self, *, assessment_mode: Optional[str] = None, patch_mode: Optional[str] = None, **kwargs): - """ - :keyword assessment_mode: Specifies the assessment mode. - :paramtype assessment_mode: str - :keyword patch_mode: Specifies the patch mode. - :paramtype patch_mode: str - """ - super().__init__(**kwargs) - self.assessment_mode = assessment_mode - self.patch_mode = patch_mode class PlacementProfile(_serialization.Model): @@ -2886,8 +2115,8 @@ def __init__( cluster_id: Optional[str] = None, host_id: Optional[str] = None, datastore_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword resource_pool_id: Gets or sets the ARM Id of the resourcePool resource on which this virtual machine will deploy. @@ -2909,6 +2138,26 @@ def __init__( self.datastore_id = datastore_id +class ResourcePatch(_serialization.Model): + """Object containing updates for patch operations. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.tags = tags + + class ResourcePool(_serialization.Model): # pylint: disable=too-many-instance-attributes """Define the resourcePool. @@ -2968,16 +2217,25 @@ class ResourcePool(_serialization.Model): # pylint: disable=too-many-instance-a :ivar mem_limit_mb: Gets or sets MemLimitMB specifies a memory usage limit in megabytes. Utilization will not exceed the specified limit even if there are available resources. :vartype mem_limit_mb: int + :ivar mem_overall_usage_gb: Gets the used physical memory on the pool in GB. + :vartype mem_overall_usage_gb: int + :ivar mem_capacity_gb: Gets the total amount of physical memory on the pool in GB. + :vartype mem_capacity_gb: int + :ivar cpu_overall_usage_m_hz: Gets the used CPU usage across all cores on the pool in MHz. + :vartype cpu_overall_usage_m_hz: int + :ivar cpu_capacity_m_hz: Gets the max CPU usage across all cores on the pool in MHz. + :vartype cpu_capacity_m_hz: int :ivar custom_resource_name: Gets the name of the corresponding resource in Kubernetes. :vartype custom_resource_name: str - :ivar datastore_ids: Gets or sets the datastore ARM ids. + :ivar datastore_ids: Gets the datastore ARM ids. :vartype datastore_ids: list[str] - :ivar network_ids: Gets or sets the network ARM ids. + :ivar network_ids: Gets the network ARM ids. :vartype network_ids: list[str] :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.connectedvmware.models.ResourceStatus] - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState """ _validation = { @@ -2994,6 +2252,10 @@ class ResourcePool(_serialization.Model): # pylint: disable=too-many-instance-a "mem_shares_level": {"readonly": True}, "mem_reservation_mb": {"readonly": True}, "mem_limit_mb": {"readonly": True}, + "mem_overall_usage_gb": {"readonly": True}, + "mem_capacity_gb": {"readonly": True}, + "cpu_overall_usage_m_hz": {"readonly": True}, + "cpu_capacity_m_hz": {"readonly": True}, "custom_resource_name": {"readonly": True}, "datastore_ids": {"readonly": True}, "network_ids": {"readonly": True}, @@ -3021,6 +2283,10 @@ class ResourcePool(_serialization.Model): # pylint: disable=too-many-instance-a "mem_shares_level": {"key": "properties.memSharesLevel", "type": "str"}, "mem_reservation_mb": {"key": "properties.memReservationMB", "type": "int"}, "mem_limit_mb": {"key": "properties.memLimitMB", "type": "int"}, + "mem_overall_usage_gb": {"key": "properties.memOverallUsageGB", "type": "int"}, + "mem_capacity_gb": {"key": "properties.memCapacityGB", "type": "int"}, + "cpu_overall_usage_m_hz": {"key": "properties.cpuOverallUsageMHz", "type": "int"}, + "cpu_capacity_m_hz": {"key": "properties.cpuCapacityMHz", "type": "int"}, "custom_resource_name": {"key": "properties.customResourceName", "type": "str"}, "datastore_ids": {"key": "properties.datastoreIds", "type": "[str]"}, "network_ids": {"key": "properties.networkIds", "type": "[str]"}, @@ -3038,8 +2304,8 @@ def __init__( # pylint: disable=too-many-locals v_center_id: Optional[str] = None, mo_ref_id: Optional[str] = None, inventory_item_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Gets or sets the location. Required. :paramtype location: str @@ -3080,6 +2346,10 @@ def __init__( # pylint: disable=too-many-locals self.mem_shares_level = None self.mem_reservation_mb = None self.mem_limit_mb = None + self.mem_overall_usage_gb = None + self.mem_capacity_gb = None + self.cpu_overall_usage_m_hz = None + self.cpu_capacity_m_hz = None self.custom_resource_name = None self.datastore_ids = None self.network_ids = None @@ -3105,8 +2375,9 @@ class ResourcePoolInventoryItem(InventoryItemProperties): :vartype mo_ref_id: str :ivar mo_name: Gets or sets the vCenter Managed Object name for the inventory item. :vartype mo_name: str - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState :ivar parent: Parent resourcePool inventory resource details. :vartype parent: ~azure.mgmt.connectedvmware.models.InventoryItemDetails """ @@ -3132,8 +2403,8 @@ def __init__( mo_ref_id: Optional[str] = None, mo_name: Optional[str] = None, parent: Optional["_models.InventoryItemDetails"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword managed_resource_id: Gets or sets the tracked resource id corresponding to the inventory resource. @@ -3171,7 +2442,7 @@ class ResourcePoolsList(_serialization.Model): "value": {"key": "value", "type": "[ResourcePool]"}, } - def __init__(self, *, value: List["_models.ResourcePool"], next_link: Optional[str] = None, **kwargs): + def __init__(self, *, value: List["_models.ResourcePool"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: Url to follow for getting next page of ResourcePools. :paramtype next_link: str @@ -3220,7 +2491,7 @@ class ResourceStatus(_serialization.Model): "last_updated_at": {"key": "lastUpdatedAt", "type": "iso-8601"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -3243,7 +2514,7 @@ class SecurityProfile(_serialization.Model): "uefi_settings": {"key": "uefiSettings", "type": "UefiSettings"}, } - def __init__(self, *, uefi_settings: Optional["_models.UefiSettings"] = None, **kwargs): + def __init__(self, *, uefi_settings: Optional["_models.UefiSettings"] = None, **kwargs: Any) -> None: """ :keyword uefi_settings: Specifies the security settings like secure boot used while creating the virtual machine. @@ -3266,7 +2537,7 @@ class StopVirtualMachineOptions(_serialization.Model): "skip_shutdown": {"key": "skipShutdown", "type": "bool"}, } - def __init__(self, *, skip_shutdown: bool = False, **kwargs): + def __init__(self, *, skip_shutdown: bool = False, **kwargs: Any) -> None: """ :keyword skip_shutdown: Gets or sets a value indicating whether to request non-graceful VM shutdown. True value for this flag indicates non-graceful shutdown whereas false indicates @@ -3298,7 +2569,7 @@ class StorageProfile(_serialization.Model): "scsi_controllers": {"key": "scsiControllers", "type": "[VirtualSCSIController]"}, } - def __init__(self, *, disks: Optional[List["_models.VirtualDisk"]] = None, **kwargs): + def __init__(self, *, disks: Optional[List["_models.VirtualDisk"]] = None, **kwargs: Any) -> None: """ :keyword disks: Gets or sets the list of virtual disks associated with the virtual machine. :paramtype disks: list[~azure.mgmt.connectedvmware.models.VirtualDisk] @@ -3319,7 +2590,7 @@ class StorageProfileUpdate(_serialization.Model): "disks": {"key": "disks", "type": "[VirtualDiskUpdate]"}, } - def __init__(self, *, disks: Optional[List["_models.VirtualDiskUpdate"]] = None, **kwargs): + def __init__(self, *, disks: Optional[List["_models.VirtualDiskUpdate"]] = None, **kwargs: Any) -> None: """ :keyword disks: Gets or sets the list of virtual disks associated with the virtual machine. :paramtype disks: list[~azure.mgmt.connectedvmware.models.VirtualDiskUpdate] @@ -3365,8 +2636,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -3404,7 +2675,7 @@ class UefiSettings(_serialization.Model): "secure_boot_enabled": {"key": "secureBootEnabled", "type": "bool"}, } - def __init__(self, *, secure_boot_enabled: Optional[bool] = None, **kwargs): + def __init__(self, *, secure_boot_enabled: Optional[bool] = None, **kwargs: Any) -> None: """ :keyword secure_boot_enabled: Specifies whether secure boot should be enabled on the virtual machine. @@ -3457,8 +2728,9 @@ class VCenter(_serialization.Model): # pylint: disable=too-many-instance-attrib :vartype credentials: ~azure.mgmt.connectedvmware.models.VICredential :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.connectedvmware.models.ResourceStatus] - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState """ _validation = { @@ -3509,8 +2781,8 @@ def __init__( kind: Optional[str] = None, port: Optional[int] = None, credentials: Optional["_models.VICredential"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Gets or sets the location. Required. :paramtype location: str @@ -3570,7 +2842,7 @@ class VCentersList(_serialization.Model): "value": {"key": "value", "type": "[VCenter]"}, } - def __init__(self, *, value: List["_models.VCenter"], next_link: Optional[str] = None, **kwargs): + def __init__(self, *, value: List["_models.VCenter"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword next_link: Url to follow for getting next page of VCenters. :paramtype next_link: str @@ -3596,7 +2868,7 @@ class VICredential(_serialization.Model): "password": {"key": "password", "type": "str"}, } - def __init__(self, *, username: Optional[str] = None, password: Optional[str] = None, **kwargs): + def __init__(self, *, username: Optional[str] = None, password: Optional[str] = None, **kwargs: Any) -> None: """ :keyword username: Gets or sets username to connect with the vCenter. :paramtype username: str @@ -3666,8 +2938,8 @@ def __init__( unit_number: Optional[int] = None, device_name: Optional[str] = None, disk_type: Optional[Union[str, "_models.DiskType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the virtual disk. :paramtype name: str @@ -3746,8 +3018,8 @@ def __init__( unit_number: Optional[int] = None, device_name: Optional[str] = None, disk_type: Optional[Union[str, "_models.DiskType"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name: Gets or sets the name of the virtual disk. :paramtype name: str @@ -3779,501 +3051,196 @@ def __init__( self.disk_type = disk_type -class VirtualMachine(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Define the virtualMachine. +class VirtualMachineInstance(ProxyResource): # pylint: disable=too-many-instance-attributes + """Define the virtualMachineInstance. Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. - - :ivar location: Gets or sets the location. Required. - :vartype location: str - :ivar extended_location: Gets or sets the extended location. - :vartype extended_location: ~azure.mgmt.connectedvmware.models.ExtendedLocation - :ivar system_data: The system data. - :vartype system_data: ~azure.mgmt.connectedvmware.models.SystemData - :ivar tags: Gets or sets the Resource tags. - :vartype tags: dict[str, str] - :ivar name: Gets or sets the name. - :vartype name: str - :ivar id: Gets or sets the Id. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str - :ivar type: Gets or sets the type of the resource. + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, - the resource provider must validate and persist this value. - :vartype kind: str - :ivar identity: The identity of the resource. - :vartype identity: ~azure.mgmt.connectedvmware.models.Identity - :ivar resource_pool_id: Gets or sets the ARM Id of the resourcePool resource on which this - virtual machine will - deploy. - :vartype resource_pool_id: str - :ivar template_id: Gets or sets the ARM Id of the template resource to deploy the virtual - machine. - :vartype template_id: str - :ivar v_center_id: Gets or sets the ARM Id of the vCenter resource in which this resource pool - resides. - :vartype v_center_id: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.connectedvmware.models.SystemData + :ivar extended_location: Gets or sets the extended location. + :vartype extended_location: ~azure.mgmt.connectedvmware.models.ExtendedLocation :ivar placement_profile: Placement properties. :vartype placement_profile: ~azure.mgmt.connectedvmware.models.PlacementProfile :ivar os_profile: OS properties. - :vartype os_profile: ~azure.mgmt.connectedvmware.models.OsProfile + :vartype os_profile: ~azure.mgmt.connectedvmware.models.OsProfileForVMInstance :ivar hardware_profile: Hardware properties. :vartype hardware_profile: ~azure.mgmt.connectedvmware.models.HardwareProfile :ivar network_profile: Network properties. :vartype network_profile: ~azure.mgmt.connectedvmware.models.NetworkProfile :ivar storage_profile: Storage properties. :vartype storage_profile: ~azure.mgmt.connectedvmware.models.StorageProfile - :ivar guest_agent_profile: Guest agent status properties. - :vartype guest_agent_profile: ~azure.mgmt.connectedvmware.models.GuestAgentProfile :ivar security_profile: Gets the security profile. :vartype security_profile: ~azure.mgmt.connectedvmware.models.SecurityProfile - :ivar mo_ref_id: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the virtual - machine. - :vartype mo_ref_id: str - :ivar inventory_item_id: Gets or sets the inventory Item ID for the virtual machine. - :vartype inventory_item_id: str - :ivar mo_name: Gets or sets the vCenter Managed Object name for the virtual machine. - :vartype mo_name: str - :ivar folder_path: Gets or sets the folder path of the vm. - :vartype folder_path: str - :ivar instance_uuid: Gets or sets the instance uuid of the vm. - :vartype instance_uuid: str - :ivar smbios_uuid: Gets or sets the SMBIOS UUID of the vm. - :vartype smbios_uuid: str - :ivar firmware_type: Firmware type. Known values are: "bios" and "efi". - :vartype firmware_type: str or ~azure.mgmt.connectedvmware.models.FirmwareType + :ivar infrastructure_profile: Gets the infrastructure profile. + :vartype infrastructure_profile: ~azure.mgmt.connectedvmware.models.InfrastructureProfile :ivar power_state: Gets the power state of the virtual machine. :vartype power_state: str - :ivar custom_resource_name: Gets the name of the corresponding resource in Kubernetes. - :vartype custom_resource_name: str - :ivar uuid: Gets or sets a unique identifier for this resource. - :vartype uuid: str :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.connectedvmware.models.ResourceStatus] - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str - :ivar vm_id: Gets or sets a unique identifier for the vm resource. - :vartype vm_id: str + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState + :ivar resource_uid: Gets or sets a unique identifier for the vm resource. + :vartype resource_uid: str """ _validation = { - "location": {"required": True}, - "system_data": {"readonly": True}, - "name": {"readonly": True}, "id": {"readonly": True}, + "name": {"readonly": True}, "type": {"readonly": True}, - "mo_name": {"readonly": True}, - "folder_path": {"readonly": True}, - "instance_uuid": {"readonly": True}, + "system_data": {"readonly": True}, "power_state": {"readonly": True}, - "custom_resource_name": {"readonly": True}, - "uuid": {"readonly": True}, "statuses": {"readonly": True}, "provisioning_state": {"readonly": True}, - "vm_id": {"readonly": True}, + "resource_uid": {"readonly": True}, } _attribute_map = { - "location": {"key": "location", "type": "str"}, - "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "name": {"key": "name", "type": "str"}, "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "kind": {"key": "kind", "type": "str"}, - "identity": {"key": "identity", "type": "Identity"}, - "resource_pool_id": {"key": "properties.resourcePoolId", "type": "str"}, - "template_id": {"key": "properties.templateId", "type": "str"}, - "v_center_id": {"key": "properties.vCenterId", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, "placement_profile": {"key": "properties.placementProfile", "type": "PlacementProfile"}, - "os_profile": {"key": "properties.osProfile", "type": "OsProfile"}, + "os_profile": {"key": "properties.osProfile", "type": "OsProfileForVMInstance"}, "hardware_profile": {"key": "properties.hardwareProfile", "type": "HardwareProfile"}, "network_profile": {"key": "properties.networkProfile", "type": "NetworkProfile"}, "storage_profile": {"key": "properties.storageProfile", "type": "StorageProfile"}, - "guest_agent_profile": {"key": "properties.guestAgentProfile", "type": "GuestAgentProfile"}, "security_profile": {"key": "properties.securityProfile", "type": "SecurityProfile"}, - "mo_ref_id": {"key": "properties.moRefId", "type": "str"}, - "inventory_item_id": {"key": "properties.inventoryItemId", "type": "str"}, - "mo_name": {"key": "properties.moName", "type": "str"}, - "folder_path": {"key": "properties.folderPath", "type": "str"}, - "instance_uuid": {"key": "properties.instanceUuid", "type": "str"}, - "smbios_uuid": {"key": "properties.smbiosUuid", "type": "str"}, - "firmware_type": {"key": "properties.firmwareType", "type": "str"}, + "infrastructure_profile": {"key": "properties.infrastructureProfile", "type": "InfrastructureProfile"}, "power_state": {"key": "properties.powerState", "type": "str"}, - "custom_resource_name": {"key": "properties.customResourceName", "type": "str"}, - "uuid": {"key": "properties.uuid", "type": "str"}, "statuses": {"key": "properties.statuses", "type": "[ResourceStatus]"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "vm_id": {"key": "properties.vmId", "type": "str"}, + "resource_uid": {"key": "properties.resourceUid", "type": "str"}, } - def __init__( # pylint: disable=too-many-locals + def __init__( self, - *, - location: str, - extended_location: Optional["_models.ExtendedLocation"] = None, - tags: Optional[Dict[str, str]] = None, - kind: Optional[str] = None, - identity: Optional["_models.Identity"] = None, - resource_pool_id: Optional[str] = None, - template_id: Optional[str] = None, - v_center_id: Optional[str] = None, + *, + extended_location: Optional["_models.ExtendedLocation"] = None, placement_profile: Optional["_models.PlacementProfile"] = None, - os_profile: Optional["_models.OsProfile"] = None, + os_profile: Optional["_models.OsProfileForVMInstance"] = None, hardware_profile: Optional["_models.HardwareProfile"] = None, network_profile: Optional["_models.NetworkProfile"] = None, storage_profile: Optional["_models.StorageProfile"] = None, - guest_agent_profile: Optional["_models.GuestAgentProfile"] = None, security_profile: Optional["_models.SecurityProfile"] = None, - mo_ref_id: Optional[str] = None, - inventory_item_id: Optional[str] = None, - smbios_uuid: Optional[str] = None, - firmware_type: Optional[Union[str, "_models.FirmwareType"]] = None, - **kwargs - ): + infrastructure_profile: Optional["_models.InfrastructureProfile"] = None, + **kwargs: Any + ) -> None: """ - :keyword location: Gets or sets the location. Required. - :paramtype location: str :keyword extended_location: Gets or sets the extended location. :paramtype extended_location: ~azure.mgmt.connectedvmware.models.ExtendedLocation - :keyword tags: Gets or sets the Resource tags. - :paramtype tags: dict[str, str] - :keyword kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, - the resource provider must validate and persist this value. - :paramtype kind: str - :keyword identity: The identity of the resource. - :paramtype identity: ~azure.mgmt.connectedvmware.models.Identity - :keyword resource_pool_id: Gets or sets the ARM Id of the resourcePool resource on which this - virtual machine will - deploy. - :paramtype resource_pool_id: str - :keyword template_id: Gets or sets the ARM Id of the template resource to deploy the virtual - machine. - :paramtype template_id: str - :keyword v_center_id: Gets or sets the ARM Id of the vCenter resource in which this resource - pool resides. - :paramtype v_center_id: str :keyword placement_profile: Placement properties. :paramtype placement_profile: ~azure.mgmt.connectedvmware.models.PlacementProfile :keyword os_profile: OS properties. - :paramtype os_profile: ~azure.mgmt.connectedvmware.models.OsProfile + :paramtype os_profile: ~azure.mgmt.connectedvmware.models.OsProfileForVMInstance :keyword hardware_profile: Hardware properties. :paramtype hardware_profile: ~azure.mgmt.connectedvmware.models.HardwareProfile :keyword network_profile: Network properties. :paramtype network_profile: ~azure.mgmt.connectedvmware.models.NetworkProfile :keyword storage_profile: Storage properties. :paramtype storage_profile: ~azure.mgmt.connectedvmware.models.StorageProfile - :keyword guest_agent_profile: Guest agent status properties. - :paramtype guest_agent_profile: ~azure.mgmt.connectedvmware.models.GuestAgentProfile :keyword security_profile: Gets the security profile. :paramtype security_profile: ~azure.mgmt.connectedvmware.models.SecurityProfile - :keyword mo_ref_id: Gets or sets the vCenter MoRef (Managed Object Reference) ID for the - virtual machine. - :paramtype mo_ref_id: str - :keyword inventory_item_id: Gets or sets the inventory Item ID for the virtual machine. - :paramtype inventory_item_id: str - :keyword smbios_uuid: Gets or sets the SMBIOS UUID of the vm. - :paramtype smbios_uuid: str - :keyword firmware_type: Firmware type. Known values are: "bios" and "efi". - :paramtype firmware_type: str or ~azure.mgmt.connectedvmware.models.FirmwareType + :keyword infrastructure_profile: Gets the infrastructure profile. + :paramtype infrastructure_profile: ~azure.mgmt.connectedvmware.models.InfrastructureProfile """ super().__init__(**kwargs) - self.location = location self.extended_location = extended_location - self.system_data = None - self.tags = tags - self.name = None - self.id = None - self.type = None - self.kind = kind - self.identity = identity - self.resource_pool_id = resource_pool_id - self.template_id = template_id - self.v_center_id = v_center_id self.placement_profile = placement_profile self.os_profile = os_profile self.hardware_profile = hardware_profile self.network_profile = network_profile self.storage_profile = storage_profile - self.guest_agent_profile = guest_agent_profile self.security_profile = security_profile - self.mo_ref_id = mo_ref_id - self.inventory_item_id = inventory_item_id - self.mo_name = None - self.folder_path = None - self.instance_uuid = None - self.smbios_uuid = smbios_uuid - self.firmware_type = firmware_type + self.infrastructure_profile = infrastructure_profile self.power_state = None - self.custom_resource_name = None - self.uuid = None self.statuses = None self.provisioning_state = None - self.vm_id = None + self.resource_uid = None -class VirtualMachineAssessPatchesResult(_serialization.Model): - """Describes the properties of an AssessPatches result. +class VirtualMachineInstancesList(_serialization.Model): + """List of VirtualMachineInstances. - Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. - :ivar status: The overall success or failure status of the operation. It remains "InProgress" - until the operation completes. At that point it will become "Unknown", "Failed", "Succeeded", - or "CompletedWithWarnings.". Known values are: "Unknown", "InProgress", "Failed", "Succeeded", - and "CompletedWithWarnings". - :vartype status: str or ~azure.mgmt.connectedvmware.models.PatchOperationStatus - :ivar assessment_activity_id: The activity ID of the operation that produced this result. - :vartype assessment_activity_id: str - :ivar reboot_pending: The overall reboot status of the VM. It will be true when partially - installed patches require a reboot to complete installation but the reboot has not yet - occurred. - :vartype reboot_pending: bool - :ivar available_patch_count_by_classification: Summarization of patches available for - installation on the machine by classification. - :vartype available_patch_count_by_classification: - ~azure.mgmt.connectedvmware.models.AvailablePatchCountByClassification - :ivar start_date_time: The UTC timestamp when the operation began. - :vartype start_date_time: ~datetime.datetime - :ivar last_modified_date_time: The UTC timestamp when the operation finished. - :vartype last_modified_date_time: ~datetime.datetime - :ivar started_by: Indicates if operation was triggered by user or by platform. Known values - are: "User" and "Platform". - :vartype started_by: str or ~azure.mgmt.connectedvmware.models.PatchOperationStartedBy - :ivar patch_service_used: Specifies the patch service used for the operation. Known values are: - "Unknown", "WU", "WU_WSUS", "YUM", "APT", and "Zypper". - :vartype patch_service_used: str or ~azure.mgmt.connectedvmware.models.PatchServiceUsed - :ivar os_type: The operating system type of the machine. Known values are: "Windows" and - "Linux". - :vartype os_type: str or ~azure.mgmt.connectedvmware.models.OsTypeUM - :ivar error_details: The errors that were encountered during execution of the operation. The - details array contains the list of them. - :vartype error_details: ~azure.mgmt.connectedvmware.models.ErrorDetail + :ivar next_link: Url to follow for getting next page of VirtualMachines. + :vartype next_link: str + :ivar value: Array of VirtualMachines. Required. + :vartype value: list[~azure.mgmt.connectedvmware.models.VirtualMachineInstance] """ _validation = { - "status": {"readonly": True}, - "assessment_activity_id": {"readonly": True}, - "reboot_pending": {"readonly": True}, - "start_date_time": {"readonly": True}, - "last_modified_date_time": {"readonly": True}, - "started_by": {"readonly": True}, - "patch_service_used": {"readonly": True}, - "os_type": {"readonly": True}, - "error_details": {"readonly": True}, + "value": {"required": True}, } _attribute_map = { - "status": {"key": "status", "type": "str"}, - "assessment_activity_id": {"key": "assessmentActivityId", "type": "str"}, - "reboot_pending": {"key": "rebootPending", "type": "bool"}, - "available_patch_count_by_classification": { - "key": "availablePatchCountByClassification", - "type": "AvailablePatchCountByClassification", - }, - "start_date_time": {"key": "startDateTime", "type": "iso-8601"}, - "last_modified_date_time": {"key": "lastModifiedDateTime", "type": "iso-8601"}, - "started_by": {"key": "startedBy", "type": "str"}, - "patch_service_used": {"key": "patchServiceUsed", "type": "str"}, - "os_type": {"key": "osType", "type": "str"}, - "error_details": {"key": "errorDetails", "type": "ErrorDetail"}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[VirtualMachineInstance]"}, } def __init__( - self, - *, - available_patch_count_by_classification: Optional["_models.AvailablePatchCountByClassification"] = None, - **kwargs - ): + self, *, value: List["_models.VirtualMachineInstance"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword available_patch_count_by_classification: Summarization of patches available for - installation on the machine by classification. - :paramtype available_patch_count_by_classification: - ~azure.mgmt.connectedvmware.models.AvailablePatchCountByClassification + :keyword next_link: Url to follow for getting next page of VirtualMachines. + :paramtype next_link: str + :keyword value: Array of VirtualMachines. Required. + :paramtype value: list[~azure.mgmt.connectedvmware.models.VirtualMachineInstance] """ super().__init__(**kwargs) - self.status = None - self.assessment_activity_id = None - self.reboot_pending = None - self.available_patch_count_by_classification = available_patch_count_by_classification - self.start_date_time = None - self.last_modified_date_time = None - self.started_by = None - self.patch_service_used = None - self.os_type = None - self.error_details = None - + self.next_link = next_link + self.value = value -class VirtualMachineInstallPatchesParameters(_serialization.Model): - """Input for InstallPatches as directly received by the API. - All required parameters must be populated in order to send to Azure. +class VirtualMachineInstanceUpdate(_serialization.Model): + """Defines the virtualMachineInstanceUpdate. - :ivar maximum_duration: Specifies the maximum amount of time that the operation will run. It - must be an ISO 8601-compliant duration string such as PT4H (4 hours). Required. - :vartype maximum_duration: str - :ivar reboot_setting: Defines when it is acceptable to reboot a VM during a software update - operation. Required. Known values are: "IfRequired", "Never", and "Always". - :vartype reboot_setting: str or ~azure.mgmt.connectedvmware.models.VMGuestPatchRebootSetting - :ivar windows_parameters: Input for InstallPatches on a Windows VM, as directly received by the - API. - :vartype windows_parameters: ~azure.mgmt.connectedvmware.models.WindowsParameters - :ivar linux_parameters: Input for InstallPatches on a Linux VM, as directly received by the - API. - :vartype linux_parameters: ~azure.mgmt.connectedvmware.models.LinuxParameters + :ivar hardware_profile: Specifies the hardware settings for the virtual machine. + :vartype hardware_profile: ~azure.mgmt.connectedvmware.models.HardwareProfile + :ivar storage_profile: Specifies the storage settings for the virtual machine disks. + :vartype storage_profile: ~azure.mgmt.connectedvmware.models.StorageProfileUpdate + :ivar network_profile: Specifies the network interfaces of the virtual machine. + :vartype network_profile: ~azure.mgmt.connectedvmware.models.NetworkProfileUpdate """ - _validation = { - "maximum_duration": {"required": True}, - "reboot_setting": {"required": True}, - } - _attribute_map = { - "maximum_duration": {"key": "maximumDuration", "type": "str"}, - "reboot_setting": {"key": "rebootSetting", "type": "str"}, - "windows_parameters": {"key": "windowsParameters", "type": "WindowsParameters"}, - "linux_parameters": {"key": "linuxParameters", "type": "LinuxParameters"}, + "hardware_profile": {"key": "properties.hardwareProfile", "type": "HardwareProfile"}, + "storage_profile": {"key": "properties.storageProfile", "type": "StorageProfileUpdate"}, + "network_profile": {"key": "properties.networkProfile", "type": "NetworkProfileUpdate"}, } def __init__( self, *, - maximum_duration: str, - reboot_setting: Union[str, "_models.VMGuestPatchRebootSetting"], - windows_parameters: Optional["_models.WindowsParameters"] = None, - linux_parameters: Optional["_models.LinuxParameters"] = None, - **kwargs - ): + hardware_profile: Optional["_models.HardwareProfile"] = None, + storage_profile: Optional["_models.StorageProfileUpdate"] = None, + network_profile: Optional["_models.NetworkProfileUpdate"] = None, + **kwargs: Any + ) -> None: """ - :keyword maximum_duration: Specifies the maximum amount of time that the operation will run. It - must be an ISO 8601-compliant duration string such as PT4H (4 hours). Required. - :paramtype maximum_duration: str - :keyword reboot_setting: Defines when it is acceptable to reboot a VM during a software update - operation. Required. Known values are: "IfRequired", "Never", and "Always". - :paramtype reboot_setting: str or ~azure.mgmt.connectedvmware.models.VMGuestPatchRebootSetting - :keyword windows_parameters: Input for InstallPatches on a Windows VM, as directly received by - the API. - :paramtype windows_parameters: ~azure.mgmt.connectedvmware.models.WindowsParameters - :keyword linux_parameters: Input for InstallPatches on a Linux VM, as directly received by the - API. - :paramtype linux_parameters: ~azure.mgmt.connectedvmware.models.LinuxParameters + :keyword hardware_profile: Specifies the hardware settings for the virtual machine. + :paramtype hardware_profile: ~azure.mgmt.connectedvmware.models.HardwareProfile + :keyword storage_profile: Specifies the storage settings for the virtual machine disks. + :paramtype storage_profile: ~azure.mgmt.connectedvmware.models.StorageProfileUpdate + :keyword network_profile: Specifies the network interfaces of the virtual machine. + :paramtype network_profile: ~azure.mgmt.connectedvmware.models.NetworkProfileUpdate """ super().__init__(**kwargs) - self.maximum_duration = maximum_duration - self.reboot_setting = reboot_setting - self.windows_parameters = windows_parameters - self.linux_parameters = linux_parameters - - -class VirtualMachineInstallPatchesResult(_serialization.Model): # pylint: disable=too-many-instance-attributes - """The result summary of an installation operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The overall success or failure status of the operation. It remains "InProgress" - until the operation completes. At that point it will become "Failed", "Succeeded", "Unknown" or - "CompletedWithWarnings.". Known values are: "Unknown", "InProgress", "Failed", "Succeeded", and - "CompletedWithWarnings". - :vartype status: str or ~azure.mgmt.connectedvmware.models.PatchOperationStatus - :ivar installation_activity_id: The activity ID of the operation that produced this result. - :vartype installation_activity_id: str - :ivar reboot_status: The reboot state of the VM following completion of the operation. Known - values are: "Unknown", "NotNeeded", "Required", "Started", "Failed", and "Completed". - :vartype reboot_status: str or ~azure.mgmt.connectedvmware.models.VMGuestPatchRebootStatus - :ivar maintenance_window_exceeded: Whether the operation ran out of time before it completed - all its intended actions. - :vartype maintenance_window_exceeded: bool - :ivar excluded_patch_count: The number of patches that were not installed due to the user - blocking their installation. - :vartype excluded_patch_count: int - :ivar not_selected_patch_count: The number of patches that were detected as available for - install, but did not meet the operation's criteria. - :vartype not_selected_patch_count: int - :ivar pending_patch_count: The number of patches that were identified as meeting the - installation criteria, but were not able to be installed. Typically this happens when - maintenanceWindowExceeded == true. - :vartype pending_patch_count: int - :ivar installed_patch_count: The number of patches successfully installed. - :vartype installed_patch_count: int - :ivar failed_patch_count: The number of patches that could not be installed due to some issue. - See errors for details. - :vartype failed_patch_count: int - :ivar start_date_time: The UTC timestamp when the operation began. - :vartype start_date_time: ~datetime.datetime - :ivar last_modified_date_time: The UTC timestamp when the operation finished. - :vartype last_modified_date_time: ~datetime.datetime - :ivar started_by: Indicates if operation was triggered by user or by platform. Known values - are: "User" and "Platform". - :vartype started_by: str or ~azure.mgmt.connectedvmware.models.PatchOperationStartedBy - :ivar patch_service_used: Specifies the patch service used for the operation. Known values are: - "Unknown", "WU", "WU_WSUS", "YUM", "APT", and "Zypper". - :vartype patch_service_used: str or ~azure.mgmt.connectedvmware.models.PatchServiceUsed - :ivar os_type: The operating system type of the machine. Known values are: "Windows" and - "Linux". - :vartype os_type: str or ~azure.mgmt.connectedvmware.models.OsTypeUM - :ivar error_details: The errors that were encountered during execution of the operation. The - details array contains the list of them. - :vartype error_details: ~azure.mgmt.connectedvmware.models.ErrorDetail - """ - - _validation = { - "status": {"readonly": True}, - "installation_activity_id": {"readonly": True}, - "reboot_status": {"readonly": True}, - "maintenance_window_exceeded": {"readonly": True}, - "excluded_patch_count": {"readonly": True}, - "not_selected_patch_count": {"readonly": True}, - "pending_patch_count": {"readonly": True}, - "installed_patch_count": {"readonly": True}, - "failed_patch_count": {"readonly": True}, - "start_date_time": {"readonly": True}, - "last_modified_date_time": {"readonly": True}, - "started_by": {"readonly": True}, - "patch_service_used": {"readonly": True}, - "os_type": {"readonly": True}, - "error_details": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "str"}, - "installation_activity_id": {"key": "installationActivityId", "type": "str"}, - "reboot_status": {"key": "rebootStatus", "type": "str"}, - "maintenance_window_exceeded": {"key": "maintenanceWindowExceeded", "type": "bool"}, - "excluded_patch_count": {"key": "excludedPatchCount", "type": "int"}, - "not_selected_patch_count": {"key": "notSelectedPatchCount", "type": "int"}, - "pending_patch_count": {"key": "pendingPatchCount", "type": "int"}, - "installed_patch_count": {"key": "installedPatchCount", "type": "int"}, - "failed_patch_count": {"key": "failedPatchCount", "type": "int"}, - "start_date_time": {"key": "startDateTime", "type": "iso-8601"}, - "last_modified_date_time": {"key": "lastModifiedDateTime", "type": "iso-8601"}, - "started_by": {"key": "startedBy", "type": "str"}, - "patch_service_used": {"key": "patchServiceUsed", "type": "str"}, - "os_type": {"key": "osType", "type": "str"}, - "error_details": {"key": "errorDetails", "type": "ErrorDetail"}, - } - - def __init__(self, **kwargs): - """ """ - super().__init__(**kwargs) - self.status = None - self.installation_activity_id = None - self.reboot_status = None - self.maintenance_window_exceeded = None - self.excluded_patch_count = None - self.not_selected_patch_count = None - self.pending_patch_count = None - self.installed_patch_count = None - self.failed_patch_count = None - self.start_date_time = None - self.last_modified_date_time = None - self.started_by = None - self.patch_service_used = None - self.os_type = None - self.error_details = None + self.hardware_profile = hardware_profile + self.storage_profile = storage_profile + self.network_profile = network_profile class VirtualMachineInventoryItem(InventoryItemProperties): # pylint: disable=too-many-instance-attributes @@ -4294,8 +3261,9 @@ class VirtualMachineInventoryItem(InventoryItemProperties): # pylint: disable=t :vartype mo_ref_id: str :ivar mo_name: Gets or sets the vCenter Managed Object name for the inventory item. :vartype mo_name: str - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState :ivar os_type: Gets or sets the type of the os. Known values are: "Windows", "Linux", and "Other". :vartype os_type: str or ~azure.mgmt.connectedvmware.models.OsType @@ -4372,8 +3340,8 @@ def __init__( cluster: Optional["_models.InventoryItemDetails"] = None, instance_uuid: Optional[str] = None, smbios_uuid: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword managed_resource_id: Gets or sets the tracked resource id corresponding to the inventory resource. @@ -4420,38 +3388,6 @@ def __init__( self.tools_version = None -class VirtualMachinesList(_serialization.Model): - """List of VirtualMachines. - - All required parameters must be populated in order to send to Azure. - - :ivar next_link: Url to follow for getting next page of VirtualMachines. - :vartype next_link: str - :ivar value: Array of VirtualMachines. Required. - :vartype value: list[~azure.mgmt.connectedvmware.models.VirtualMachine] - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[VirtualMachine]"}, - } - - def __init__(self, *, value: List["_models.VirtualMachine"], next_link: Optional[str] = None, **kwargs): - """ - :keyword next_link: Url to follow for getting next page of VirtualMachines. - :paramtype next_link: str - :keyword value: Array of VirtualMachines. Required. - :paramtype value: list[~azure.mgmt.connectedvmware.models.VirtualMachine] - """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = value - - class VirtualMachineTemplate(_serialization.Model): # pylint: disable=too-many-instance-attributes """Define the virtualMachineTemplate. @@ -4519,8 +3455,9 @@ class VirtualMachineTemplate(_serialization.Model): # pylint: disable=too-many- :vartype firmware_type: str or ~azure.mgmt.connectedvmware.models.FirmwareType :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.connectedvmware.models.ResourceStatus] - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState """ _validation = { @@ -4587,8 +3524,8 @@ def __init__( # pylint: disable=too-many-locals v_center_id: Optional[str] = None, mo_ref_id: Optional[str] = None, inventory_item_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Gets or sets the location. Required. :paramtype location: str @@ -4659,8 +3596,9 @@ class VirtualMachineTemplateInventoryItem(InventoryItemProperties): # pylint: d :vartype mo_ref_id: str :ivar mo_name: Gets or sets the vCenter Managed Object name for the inventory item. :vartype mo_name: str - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState :ivar memory_size_mb: Gets or sets memory size in MBs for the template. :vartype memory_size_mb: int :ivar num_cp_us: Gets or sets the number of vCPUs for the template. @@ -4717,8 +3655,8 @@ def __init__( os_type: Optional[Union[str, "_models.OsType"]] = None, os_name: Optional[str] = None, folder_path: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword managed_resource_id: Gets or sets the tracked resource id corresponding to the inventory resource. @@ -4775,7 +3713,9 @@ class VirtualMachineTemplatesList(_serialization.Model): "value": {"key": "value", "type": "[VirtualMachineTemplate]"}, } - def __init__(self, *, value: List["_models.VirtualMachineTemplate"], next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: List["_models.VirtualMachineTemplate"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword next_link: Url to follow for getting next page of VirtualMachineTemplates. :paramtype next_link: str @@ -4787,73 +3727,6 @@ def __init__(self, *, value: List["_models.VirtualMachineTemplate"], next_link: self.value = value -class VirtualMachineUpdate(_serialization.Model): - """Defines the virtualMachineUpdate. - - :ivar tags: Gets or sets the Resource tags. - :vartype tags: dict[str, str] - :ivar identity: The identity of the resource. - :vartype identity: ~azure.mgmt.connectedvmware.models.Identity - :ivar hardware_profile: Specifies the hardware settings for the virtual machine. - :vartype hardware_profile: ~azure.mgmt.connectedvmware.models.HardwareProfile - :ivar os_profile: OS properties. - :vartype os_profile: ~azure.mgmt.connectedvmware.models.OsProfileUpdate - :ivar storage_profile: Specifies the storage settings for the virtual machine disks. - :vartype storage_profile: ~azure.mgmt.connectedvmware.models.StorageProfileUpdate - :ivar network_profile: Specifies the network interfaces of the virtual machine. - :vartype network_profile: ~azure.mgmt.connectedvmware.models.NetworkProfileUpdate - :ivar guest_agent_profile: Specifies the guest agent settings for the virtual machine. - :vartype guest_agent_profile: ~azure.mgmt.connectedvmware.models.GuestAgentProfileUpdate - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "Identity"}, - "hardware_profile": {"key": "properties.hardwareProfile", "type": "HardwareProfile"}, - "os_profile": {"key": "properties.osProfile", "type": "OsProfileUpdate"}, - "storage_profile": {"key": "properties.storageProfile", "type": "StorageProfileUpdate"}, - "network_profile": {"key": "properties.networkProfile", "type": "NetworkProfileUpdate"}, - "guest_agent_profile": {"key": "properties.guestAgentProfile", "type": "GuestAgentProfileUpdate"}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.Identity"] = None, - hardware_profile: Optional["_models.HardwareProfile"] = None, - os_profile: Optional["_models.OsProfileUpdate"] = None, - storage_profile: Optional["_models.StorageProfileUpdate"] = None, - network_profile: Optional["_models.NetworkProfileUpdate"] = None, - guest_agent_profile: Optional["_models.GuestAgentProfileUpdate"] = None, - **kwargs - ): - """ - :keyword tags: Gets or sets the Resource tags. - :paramtype tags: dict[str, str] - :keyword identity: The identity of the resource. - :paramtype identity: ~azure.mgmt.connectedvmware.models.Identity - :keyword hardware_profile: Specifies the hardware settings for the virtual machine. - :paramtype hardware_profile: ~azure.mgmt.connectedvmware.models.HardwareProfile - :keyword os_profile: OS properties. - :paramtype os_profile: ~azure.mgmt.connectedvmware.models.OsProfileUpdate - :keyword storage_profile: Specifies the storage settings for the virtual machine disks. - :paramtype storage_profile: ~azure.mgmt.connectedvmware.models.StorageProfileUpdate - :keyword network_profile: Specifies the network interfaces of the virtual machine. - :paramtype network_profile: ~azure.mgmt.connectedvmware.models.NetworkProfileUpdate - :keyword guest_agent_profile: Specifies the guest agent settings for the virtual machine. - :paramtype guest_agent_profile: ~azure.mgmt.connectedvmware.models.GuestAgentProfileUpdate - """ - super().__init__(**kwargs) - self.tags = tags - self.identity = identity - self.hardware_profile = hardware_profile - self.os_profile = os_profile - self.storage_profile = storage_profile - self.network_profile = network_profile - self.guest_agent_profile = guest_agent_profile - - class VirtualNetwork(_serialization.Model): # pylint: disable=too-many-instance-attributes """Define the virtualNetwork. @@ -4895,8 +3768,9 @@ class VirtualNetwork(_serialization.Model): # pylint: disable=too-many-instance :vartype custom_resource_name: str :ivar statuses: The resource status information. :vartype statuses: list[~azure.mgmt.connectedvmware.models.ResourceStatus] - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState """ _validation = { @@ -4941,8 +3815,8 @@ def __init__( v_center_id: Optional[str] = None, mo_ref_id: Optional[str] = None, inventory_item_id: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword location: Gets or sets the location. Required. :paramtype location: str @@ -5000,8 +3874,9 @@ class VirtualNetworkInventoryItem(InventoryItemProperties): :vartype mo_ref_id: str :ivar mo_name: Gets or sets the vCenter Managed Object name for the inventory item. :vartype mo_name: str - :ivar provisioning_state: Gets or sets the provisioning state. - :vartype provisioning_state: str + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState """ _validation = { @@ -5023,8 +3898,8 @@ def __init__( managed_resource_id: Optional[str] = None, mo_ref_id: Optional[str] = None, mo_name: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword managed_resource_id: Gets or sets the tracked resource id corresponding to the inventory resource. @@ -5059,7 +3934,9 @@ class VirtualNetworksList(_serialization.Model): "value": {"key": "value", "type": "[VirtualNetwork]"}, } - def __init__(self, *, value: List["_models.VirtualNetwork"], next_link: Optional[str] = None, **kwargs): + def __init__( + self, *, value: List["_models.VirtualNetwork"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword next_link: Url to follow for getting next page of VirtualNetworks. :paramtype next_link: str @@ -5072,7 +3949,8 @@ def __init__(self, *, value: List["_models.VirtualNetwork"], next_link: Optional class VirtualSCSIController(_serialization.Model): - """This data object type contains the properties of a SCSI controller device attached to a virtual machine that is reported by the controller. + """This data object type contains the properties of a SCSI controller device attached to a virtual + machine that is reported by the controller. :ivar type: Gets or sets the controller type. Known values are: "lsilogic", "buslogic", "pvscsi", and "lsilogicsas". @@ -5104,8 +3982,8 @@ def __init__( bus_number: Optional[int] = None, scsi_ctlr_unit_number: Optional[int] = None, sharing: Optional[Union[str, "_models.VirtualSCSISharing"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: Gets or sets the controller type. Known values are: "lsilogic", "buslogic", "pvscsi", and "lsilogicsas". @@ -5128,62 +4006,91 @@ def __init__( self.sharing = sharing -class WindowsParameters(_serialization.Model): - """Input for InstallPatches on a Windows VM, as directly received by the API. - - :ivar classifications_to_include: The update classifications to select when installing patches - for Windows. - :vartype classifications_to_include: list[str or - ~azure.mgmt.connectedvmware.models.VMGuestPatchClassificationWindows] - :ivar kb_numbers_to_include: Kbs to include in the patch operation. - :vartype kb_numbers_to_include: list[str] - :ivar kb_numbers_to_exclude: Kbs to exclude in the patch operation. - :vartype kb_numbers_to_exclude: list[str] - :ivar exclude_kbs_requiring_reboot: Filters out Kbs that don't have an - InstallationRebootBehavior of 'NeverReboots' when this is set to true. - :vartype exclude_kbs_requiring_reboot: bool - :ivar max_patch_publish_date: This is used to install patches that were published on or before - this given max published date. - :vartype max_patch_publish_date: ~datetime.datetime +class VmInstanceHybridIdentityMetadata(ProxyResource): + """Defines the HybridIdentityMetadata. + + 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}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.connectedvmware.models.SystemData + :ivar resource_uid: The unique identifier for the resource. + :vartype resource_uid: str + :ivar public_key: Gets or sets the Public Key. + :vartype public_key: str + :ivar provisioning_state: Gets the provisioning state. Known values are: "Succeeded", "Failed", + "Canceled", "Provisioning", "Updating", "Deleting", "Accepted", and "Created". + :vartype provisioning_state: str or ~azure.mgmt.connectedvmware.models.ProvisioningState + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "resource_uid": {"key": "properties.resourceUid", "type": "str"}, + "public_key": {"key": "properties.publicKey", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__(self, *, resource_uid: Optional[str] = None, public_key: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword resource_uid: The unique identifier for the resource. + :paramtype resource_uid: str + :keyword public_key: Gets or sets the Public Key. + :paramtype public_key: str + """ + super().__init__(**kwargs) + self.resource_uid = resource_uid + self.public_key = public_key + self.provisioning_state = None + + +class VmInstanceHybridIdentityMetadataList(_serialization.Model): + """List of HybridIdentityMetadata. + + All required parameters must be populated in order to send to Azure. + + :ivar next_link: Url to follow for getting next page of HybridIdentityMetadata. + :vartype next_link: str + :ivar value: Array of HybridIdentityMetadata. Required. + :vartype value: list[~azure.mgmt.connectedvmware.models.VmInstanceHybridIdentityMetadata] """ + _validation = { + "value": {"required": True}, + } + _attribute_map = { - "classifications_to_include": {"key": "classificationsToInclude", "type": "[str]"}, - "kb_numbers_to_include": {"key": "kbNumbersToInclude", "type": "[str]"}, - "kb_numbers_to_exclude": {"key": "kbNumbersToExclude", "type": "[str]"}, - "exclude_kbs_requiring_reboot": {"key": "excludeKbsRequiringReboot", "type": "bool"}, - "max_patch_publish_date": {"key": "maxPatchPublishDate", "type": "iso-8601"}, + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[VmInstanceHybridIdentityMetadata]"}, } def __init__( - self, - *, - classifications_to_include: Optional[List[Union[str, "_models.VMGuestPatchClassificationWindows"]]] = None, - kb_numbers_to_include: Optional[List[str]] = None, - kb_numbers_to_exclude: Optional[List[str]] = None, - exclude_kbs_requiring_reboot: Optional[bool] = None, - max_patch_publish_date: Optional[datetime.datetime] = None, - **kwargs - ): + self, *, value: List["_models.VmInstanceHybridIdentityMetadata"], next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ - :keyword classifications_to_include: The update classifications to select when installing - patches for Windows. - :paramtype classifications_to_include: list[str or - ~azure.mgmt.connectedvmware.models.VMGuestPatchClassificationWindows] - :keyword kb_numbers_to_include: Kbs to include in the patch operation. - :paramtype kb_numbers_to_include: list[str] - :keyword kb_numbers_to_exclude: Kbs to exclude in the patch operation. - :paramtype kb_numbers_to_exclude: list[str] - :keyword exclude_kbs_requiring_reboot: Filters out Kbs that don't have an - InstallationRebootBehavior of 'NeverReboots' when this is set to true. - :paramtype exclude_kbs_requiring_reboot: bool - :keyword max_patch_publish_date: This is used to install patches that were published on or - before this given max published date. - :paramtype max_patch_publish_date: ~datetime.datetime + :keyword next_link: Url to follow for getting next page of HybridIdentityMetadata. + :paramtype next_link: str + :keyword value: Array of HybridIdentityMetadata. Required. + :paramtype value: list[~azure.mgmt.connectedvmware.models.VmInstanceHybridIdentityMetadata] """ super().__init__(**kwargs) - self.classifications_to_include = classifications_to_include - self.kb_numbers_to_include = kb_numbers_to_include - self.kb_numbers_to_exclude = kb_numbers_to_exclude - self.exclude_kbs_requiring_reboot = exclude_kbs_requiring_reboot - self.max_patch_publish_date = max_patch_publish_date + self.next_link = next_link + self.value = value diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/__init__.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/__init__.py index 5cf879bbc55c..d0665772204e 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/__init__.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/__init__.py @@ -7,7 +7,6 @@ # -------------------------------------------------------------------------- from ._operations import Operations -from ._virtual_machines_operations import VirtualMachinesOperations from ._resource_pools_operations import ResourcePoolsOperations from ._clusters_operations import ClustersOperations from ._hosts_operations import HostsOperations @@ -16,10 +15,9 @@ from ._virtual_machine_templates_operations import VirtualMachineTemplatesOperations from ._virtual_networks_operations import VirtualNetworksOperations from ._inventory_items_operations import InventoryItemsOperations -from ._hybrid_identity_metadata_operations import HybridIdentityMetadataOperations -from ._machine_extensions_operations import MachineExtensionsOperations -from ._azure_arc_vmware_management_service_api_operations import AzureArcVMwareManagementServiceAPIOperationsMixin -from ._guest_agents_operations import GuestAgentsOperations +from ._virtual_machine_instances_operations import VirtualMachineInstancesOperations +from ._vm_instance_hybrid_identity_metadata_operations import VmInstanceHybridIdentityMetadataOperations +from ._vm_instance_guest_agents_operations import VMInstanceGuestAgentsOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -27,7 +25,6 @@ __all__ = [ "Operations", - "VirtualMachinesOperations", "ResourcePoolsOperations", "ClustersOperations", "HostsOperations", @@ -36,10 +33,9 @@ "VirtualMachineTemplatesOperations", "VirtualNetworksOperations", "InventoryItemsOperations", - "HybridIdentityMetadataOperations", - "MachineExtensionsOperations", - "AzureArcVMwareManagementServiceAPIOperationsMixin", - "GuestAgentsOperations", + "VirtualMachineInstancesOperations", + "VmInstanceHybridIdentityMetadataOperations", + "VMInstanceGuestAgentsOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_azure_arc_vmware_management_service_api_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_azure_arc_vmware_management_service_api_operations.py deleted file mode 100644 index f7af63bd36b6..000000000000 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_azure_arc_vmware_management_service_api_operations.py +++ /dev/null @@ -1,297 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_upgrade_extensions_request( - resource_group_name: str, virtual_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/upgradeExtensions", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class AzureArcVMwareManagementServiceAPIOperationsMixin(AzureArcVMwareManagementServiceAPIMixinABC): - def _upgrade_extensions_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - virtual_machine_name: str, - extension_upgrade_parameters: Union[_models.MachineExtensionUpgrade, IO], - **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(extension_upgrade_parameters, (IO, bytes)): - _content = extension_upgrade_parameters - else: - _json = self._serialize.body(extension_upgrade_parameters, "MachineExtensionUpgrade") - - request = build_upgrade_extensions_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._upgrade_extensions_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _upgrade_extensions_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/upgradeExtensions" - } - - @overload - def begin_upgrade_extensions( - self, - resource_group_name: str, - virtual_machine_name: str, - extension_upgrade_parameters: _models.MachineExtensionUpgrade, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """The operation to Upgrade Machine Extensions. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the machine containing the extension. Required. - :type virtual_machine_name: str - :param extension_upgrade_parameters: Parameters supplied to the Upgrade Extensions operation. - Required. - :type extension_upgrade_parameters: ~azure.mgmt.connectedvmware.models.MachineExtensionUpgrade - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_upgrade_extensions( - self, - resource_group_name: str, - virtual_machine_name: str, - extension_upgrade_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """The operation to Upgrade Machine Extensions. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the machine containing the extension. Required. - :type virtual_machine_name: str - :param extension_upgrade_parameters: Parameters supplied to the Upgrade Extensions operation. - Required. - :type extension_upgrade_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_upgrade_extensions( - self, - resource_group_name: str, - virtual_machine_name: str, - extension_upgrade_parameters: Union[_models.MachineExtensionUpgrade, IO], - **kwargs: Any - ) -> LROPoller[None]: - """The operation to Upgrade Machine Extensions. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the machine containing the extension. Required. - :type virtual_machine_name: str - :param extension_upgrade_parameters: Parameters supplied to the Upgrade Extensions operation. - Is either a model type or a IO type. Required. - :type extension_upgrade_parameters: ~azure.mgmt.connectedvmware.models.MachineExtensionUpgrade - or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = 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) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._upgrade_extensions_initial( # type: ignore - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - extension_upgrade_parameters=extension_upgrade_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_upgrade_extensions.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/upgradeExtensions" - } diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_clusters_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_clusters_operations.py index fef51f26ce64..58646b3247e3 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_clusters_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_clusters_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -66,7 +60,7 @@ def build_create_request( "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,9 +77,7 @@ def build_get_request(resource_group_name: str, cluster_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +91,7 @@ def build_get_request(resource_group_name: str, cluster_name: str, subscription_ "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -116,9 +108,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -133,7 +123,7 @@ def build_update_request( "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -152,9 +142,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -168,7 +156,7 @@ def build_delete_request( "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -185,9 +173,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -198,7 +184,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -213,9 +199,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -228,7 +212,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -276,16 +260,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Cluster] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -308,8 +290,9 @@ def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -422,7 +405,7 @@ def begin_create( :type resource_group_name: str :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a Cluster type or a IO type. Default value is None. :type body: ~azure.mgmt.connectedvmware.models.Cluster or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -442,9 +425,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Cluster] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -517,9 +498,7 @@ def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Cluster] = kwargs.pop("cls", None) request = build_get_request( @@ -534,8 +513,9 @@ def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _mo request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -630,8 +610,8 @@ def update( :type resource_group_name: str :param cluster_name: Name of the cluster. Required. :type cluster_name: str - :param body: Resource properties to update. Is either a model type or a IO type. Default value - is None. + :param body: Resource properties to update. Is either a ResourcePatch type or a IO type. + Default value is None. :type body: ~azure.mgmt.connectedvmware.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -652,16 +632,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Cluster] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -684,8 +662,9 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -720,9 +699,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -738,8 +715,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -749,8 +727,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/clusters/{clusterName}" @@ -785,9 +767,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -842,9 +822,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Cluster"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClustersList] = kwargs.pop("cls", None) error_map = { @@ -896,8 +874,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -928,9 +907,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClustersList] = kwargs.pop("cls", None) error_map = { @@ -983,8 +960,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_datastores_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_datastores_operations.py index e36c74629aaf..aff6e6f63607 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_datastores_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_datastores_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -66,7 +60,7 @@ def build_create_request( "datastoreName": _SERIALIZER.url("datastore_name", datastore_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -85,9 +79,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +93,7 @@ def build_get_request( "datastoreName": _SERIALIZER.url("datastore_name", datastore_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -118,9 +110,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -135,7 +125,7 @@ def build_update_request( "datastoreName": _SERIALIZER.url("datastore_name", datastore_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -154,9 +144,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -170,7 +158,7 @@ def build_delete_request( "datastoreName": _SERIALIZER.url("datastore_name", datastore_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -187,9 +175,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -200,7 +186,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -215,9 +201,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -230,7 +214,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -278,16 +262,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Datastore] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -310,8 +292,9 @@ def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -424,7 +407,7 @@ def begin_create( :type resource_group_name: str :param datastore_name: Name of the datastore. Required. :type datastore_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a Datastore type or a IO type. Default value is None. :type body: ~azure.mgmt.connectedvmware.models.Datastore or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -444,9 +427,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Datastore] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -519,9 +500,7 @@ def get(self, resource_group_name: str, datastore_name: str, **kwargs: Any) -> _ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Datastore] = kwargs.pop("cls", None) request = build_get_request( @@ -536,8 +515,9 @@ def get(self, resource_group_name: str, datastore_name: str, **kwargs: Any) -> _ request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -632,8 +612,8 @@ def update( :type resource_group_name: str :param datastore_name: Name of the datastore. Required. :type datastore_name: str - :param body: Resource properties to update. Is either a model type or a IO type. Default value - is None. + :param body: Resource properties to update. Is either a ResourcePatch type or a IO type. + Default value is None. :type body: ~azure.mgmt.connectedvmware.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -654,16 +634,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Datastore] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -686,8 +664,9 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -722,9 +701,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -740,8 +717,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -751,8 +729,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/datastores/{datastoreName}" @@ -787,9 +769,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -844,9 +824,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Datastore"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DatastoresList] = kwargs.pop("cls", None) error_map = { @@ -898,8 +876,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -930,9 +909,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DatastoresList] = kwargs.pop("cls", None) error_map = { @@ -985,8 +962,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_hosts_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_hosts_operations.py index e57a09e0e4c1..f825956f5134 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_hosts_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_hosts_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,9 +43,7 @@ def build_create_request(resource_group_name: str, host_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -64,7 +58,7 @@ def build_create_request(resource_group_name: str, host_name: str, subscription_ "hostName": _SERIALIZER.url("host_name", host_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -81,9 +75,7 @@ def build_get_request(resource_group_name: str, host_name: str, subscription_id: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +89,7 @@ def build_get_request(resource_group_name: str, host_name: str, subscription_id: "hostName": _SERIALIZER.url("host_name", host_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -112,9 +104,7 @@ def build_update_request(resource_group_name: str, host_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -129,7 +119,7 @@ def build_update_request(resource_group_name: str, host_name: str, subscription_ "hostName": _SERIALIZER.url("host_name", host_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -148,9 +138,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -164,7 +152,7 @@ def build_delete_request( "hostName": _SERIALIZER.url("host_name", host_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -181,9 +169,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -194,7 +180,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -209,9 +195,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -224,7 +208,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -268,16 +252,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Host] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -300,8 +282,9 @@ def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -410,7 +393,7 @@ def begin_create( :type resource_group_name: str :param host_name: Name of the host. Required. :type host_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a Host type or a IO type. Default value is None. :type body: ~azure.mgmt.connectedvmware.models.Host or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -430,9 +413,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Host] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -505,9 +486,7 @@ def get(self, resource_group_name: str, host_name: str, **kwargs: Any) -> _model _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Host] = kwargs.pop("cls", None) request = build_get_request( @@ -522,8 +501,9 @@ def get(self, resource_group_name: str, host_name: str, **kwargs: Any) -> _model request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -618,8 +598,8 @@ def update( :type resource_group_name: str :param host_name: Name of the host. Required. :type host_name: str - :param body: Resource properties to update. Is either a model type or a IO type. Default value - is None. + :param body: Resource properties to update. Is either a ResourcePatch type or a IO type. + Default value is None. :type body: ~azure.mgmt.connectedvmware.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -640,16 +620,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.Host] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -672,8 +650,9 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -708,9 +687,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -726,8 +703,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -737,8 +715,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/hosts/{hostName}" @@ -773,9 +755,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -830,9 +810,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Host"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HostsList] = kwargs.pop("cls", None) error_map = { @@ -884,8 +862,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -916,9 +895,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.HostsList] = kwargs.pop("cls", None) error_map = { @@ -971,8 +948,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_hybrid_identity_metadata_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_hybrid_identity_metadata_operations.py deleted file mode 100644 index 77eb4d3e60f2..000000000000 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_hybrid_identity_metadata_operations.py +++ /dev/null @@ -1,589 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_request( - resource_group_name: str, virtual_machine_name: str, metadata_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), - "metadataName": _SERIALIZER.url("metadata_name", metadata_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, virtual_machine_name: str, metadata_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), - "metadataName": _SERIALIZER.url("metadata_name", metadata_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, virtual_machine_name: str, metadata_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), - "metadataName": _SERIALIZER.url("metadata_name", metadata_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, virtual_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/hybridIdentityMetadata", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class HybridIdentityMetadataOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.connectedvmware.AzureArcVMwareManagementServiceAPI`'s - :attr:`hybrid_identity_metadata` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - def create( - self, - resource_group_name: str, - virtual_machine_name: str, - metadata_name: str, - body: Optional[_models.HybridIdentityMetadata] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.HybridIdentityMetadata: - """Implements HybridIdentityMetadata PUT method. - - Create Or Update HybridIdentityMetadata. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param metadata_name: Name of the hybridIdentityMetadata. Required. - :type metadata_name: str - :param body: Request payload. Default value is None. - :type body: ~azure.mgmt.connectedvmware.models.HybridIdentityMetadata - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: HybridIdentityMetadata or the result of cls(response) - :rtype: ~azure.mgmt.connectedvmware.models.HybridIdentityMetadata - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - resource_group_name: str, - virtual_machine_name: str, - metadata_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.HybridIdentityMetadata: - """Implements HybridIdentityMetadata PUT method. - - Create Or Update HybridIdentityMetadata. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param metadata_name: Name of the hybridIdentityMetadata. Required. - :type metadata_name: str - :param body: Request payload. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: HybridIdentityMetadata or the result of cls(response) - :rtype: ~azure.mgmt.connectedvmware.models.HybridIdentityMetadata - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, - resource_group_name: str, - virtual_machine_name: str, - metadata_name: str, - body: Optional[Union[_models.HybridIdentityMetadata, IO]] = None, - **kwargs: Any - ) -> _models.HybridIdentityMetadata: - """Implements HybridIdentityMetadata PUT method. - - Create Or Update HybridIdentityMetadata. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param metadata_name: Name of the hybridIdentityMetadata. Required. - :type metadata_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. - :type body: ~azure.mgmt.connectedvmware.models.HybridIdentityMetadata or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: HybridIdentityMetadata or the result of cls(response) - :rtype: ~azure.mgmt.connectedvmware.models.HybridIdentityMetadata - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = 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.HybridIdentityMetadata] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IO, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "HybridIdentityMetadata") - else: - _json = None - - request = build_create_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - metadata_name=metadata_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.create.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("HybridIdentityMetadata", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName}" - } - - @distributed_trace - def get( - self, resource_group_name: str, virtual_machine_name: str, metadata_name: str, **kwargs: Any - ) -> _models.HybridIdentityMetadata: - """Gets HybridIdentityMetadata. - - Implements HybridIdentityMetadata GET method. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param metadata_name: Name of the HybridIdentityMetadata. Required. - :type metadata_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: HybridIdentityMetadata or the result of cls(response) - :rtype: ~azure.mgmt.connectedvmware.models.HybridIdentityMetadata - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.HybridIdentityMetadata] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - metadata_name=metadata_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("HybridIdentityMetadata", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName}" - } - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtual_machine_name: str, metadata_name: str, **kwargs: Any - ) -> None: - """Deletes an HybridIdentityMetadata. - - Implements HybridIdentityMetadata DELETE method. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param metadata_name: Name of the HybridIdentityMetadata. Required. - :type metadata_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - metadata_name=metadata_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/hybridIdentityMetadata/{metadataName}" - } - - @distributed_trace - def list( - self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any - ) -> Iterable["_models.HybridIdentityMetadata"]: - """Implements GET HybridIdentityMetadata in a vm. - - Returns the list of HybridIdentityMetadata of the given vm. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either HybridIdentityMetadata or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.connectedvmware.models.HybridIdentityMetadata] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.HybridIdentityMetadataList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("HybridIdentityMetadataList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/hybridIdentityMetadata" - } diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_inventory_items_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_inventory_items_operations.py index 7a2db774aa94..1b932d6fc396 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_inventory_items_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_inventory_items_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -28,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,9 +43,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -65,7 +59,7 @@ def build_create_request( "inventoryItemName": _SERIALIZER.url("inventory_item_name", inventory_item_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -84,9 +78,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +93,7 @@ def build_get_request( "inventoryItemName": _SERIALIZER.url("inventory_item_name", inventory_item_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -118,9 +110,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -135,7 +125,7 @@ def build_delete_request( "inventoryItemName": _SERIALIZER.url("inventory_item_name", inventory_item_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -152,9 +142,7 @@ def build_list_by_v_center_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -168,7 +156,7 @@ def build_list_by_v_center_request( "vcenterName": _SERIALIZER.url("vcenter_name", vcenter_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -281,7 +269,8 @@ def create( :type vcenter_name: str :param inventory_item_name: Name of the inventoryItem. Required. :type inventory_item_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a InventoryItem type or a IO type. Default value is + None. :type body: ~azure.mgmt.connectedvmware.models.InventoryItem or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -302,16 +291,14 @@ def create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.InventoryItem] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -335,8 +322,9 @@ def create( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -387,9 +375,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.InventoryItem] = kwargs.pop("cls", None) request = build_get_request( @@ -405,8 +391,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -457,9 +444,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -475,8 +460,9 @@ def delete( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -513,9 +499,7 @@ def list_by_v_center( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.InventoryItemsList] = kwargs.pop("cls", None) error_map = { @@ -569,8 +553,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_machine_extensions_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_machine_extensions_operations.py deleted file mode 100644 index fe9f7cc6cc63..000000000000 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_machine_extensions_operations.py +++ /dev/null @@ -1,1017 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_or_update_request( - resource_group_name: str, virtual_machine_name: str, extension_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/extensions/{extensionName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), - "extensionName": _SERIALIZER.url("extension_name", extension_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, virtual_machine_name: str, extension_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/extensions/{extensionName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), - "extensionName": _SERIALIZER.url("extension_name", extension_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, virtual_machine_name: str, extension_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/extensions/{extensionName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), - "extensionName": _SERIALIZER.url("extension_name", extension_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, virtual_machine_name: str, extension_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/extensions/{extensionName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), - "extensionName": _SERIALIZER.url("extension_name", extension_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, - virtual_machine_name: str, - subscription_id: str, - *, - expand: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/extensions", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class MachineExtensionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.connectedvmware.AzureArcVMwareManagementServiceAPI`'s - :attr:`machine_extensions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - def _create_or_update_initial( - self, - resource_group_name: str, - virtual_machine_name: str, - extension_name: str, - extension_parameters: Union[_models.MachineExtension, IO], - **kwargs: Any - ) -> _models.MachineExtension: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = 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.MachineExtension] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(extension_parameters, (IO, bytes)): - _content = extension_parameters - else: - _json = self._serialize.body(extension_parameters, "MachineExtension") - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - extension_name=extension_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_or_update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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("MachineExtension", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("MachineExtension", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/extensions/{extensionName}" - } - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - virtual_machine_name: str, - extension_name: str, - extension_parameters: _models.MachineExtension, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.MachineExtension]: - """The operation to create or update the extension. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the machine where the extension should be created or - updated. Required. - :type virtual_machine_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. - Required. - :type extension_parameters: ~azure.mgmt.connectedvmware.models.MachineExtension - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either MachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.connectedvmware.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - virtual_machine_name: str, - extension_name: str, - extension_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.MachineExtension]: - """The operation to create or update the extension. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the machine where the extension should be created or - updated. Required. - :type virtual_machine_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. - Required. - :type extension_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either MachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.connectedvmware.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - virtual_machine_name: str, - extension_name: str, - extension_parameters: Union[_models.MachineExtension, IO], - **kwargs: Any - ) -> LROPoller[_models.MachineExtension]: - """The operation to create or update the extension. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the machine where the extension should be created or - updated. Required. - :type virtual_machine_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. Is - either a model type or a IO type. Required. - :type extension_parameters: ~azure.mgmt.connectedvmware.models.MachineExtension or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either MachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.connectedvmware.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = 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.MachineExtension] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - extension_name=extension_name, - extension_parameters=extension_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MachineExtension", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/extensions/{extensionName}" - } - - def _update_initial( - self, - resource_group_name: str, - virtual_machine_name: str, - extension_name: str, - extension_parameters: Union[_models.MachineExtensionUpdate, IO], - **kwargs: Any - ) -> _models.MachineExtension: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = 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.MachineExtension] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(extension_parameters, (IO, bytes)): - _content = extension_parameters - else: - _json = self._serialize.body(extension_parameters, "MachineExtensionUpdate") - - request = build_update_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - extension_name=extension_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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("MachineExtension", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("MachineExtension", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/extensions/{extensionName}" - } - - @overload - def begin_update( - self, - resource_group_name: str, - virtual_machine_name: str, - extension_name: str, - extension_parameters: _models.MachineExtensionUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.MachineExtension]: - """The operation to update the extension. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the machine where the extension should be created or - updated. Required. - :type virtual_machine_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. - Required. - :type extension_parameters: ~azure.mgmt.connectedvmware.models.MachineExtensionUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either MachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.connectedvmware.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - virtual_machine_name: str, - extension_name: str, - extension_parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.MachineExtension]: - """The operation to update the extension. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the machine where the extension should be created or - updated. Required. - :type virtual_machine_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. - Required. - :type extension_parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either MachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.connectedvmware.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - virtual_machine_name: str, - extension_name: str, - extension_parameters: Union[_models.MachineExtensionUpdate, IO], - **kwargs: Any - ) -> LROPoller[_models.MachineExtension]: - """The operation to update the extension. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the machine where the extension should be created or - updated. Required. - :type virtual_machine_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. Is - either a model type or a IO type. Required. - :type extension_parameters: ~azure.mgmt.connectedvmware.models.MachineExtensionUpdate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either MachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.connectedvmware.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = 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.MachineExtension] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - extension_name=extension_name, - extension_parameters=extension_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("MachineExtension", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/extensions/{extensionName}" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtual_machine_name: str, extension_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - extension_name=extension_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._delete_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/extensions/{extensionName}" - } - - @distributed_trace - def begin_delete( - self, resource_group_name: str, virtual_machine_name: str, extension_name: str, **kwargs: Any - ) -> LROPoller[None]: - """The operation to delete the extension. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the machine where the extension should be deleted. - Required. - :type virtual_machine_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - extension_name=extension_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/extensions/{extensionName}" - } - - @distributed_trace - def get( - self, resource_group_name: str, virtual_machine_name: str, extension_name: str, **kwargs: Any - ) -> _models.MachineExtension: - """The operation to get the extension. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the machine containing the extension. Required. - :type virtual_machine_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: MachineExtension or the result of cls(response) - :rtype: ~azure.mgmt.connectedvmware.models.MachineExtension - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.MachineExtension] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - extension_name=extension_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("MachineExtension", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/extensions/{extensionName}" - } - - @distributed_trace - def list( - self, resource_group_name: str, virtual_machine_name: str, expand: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.MachineExtension"]: - """The operation to get all extensions of a non-Azure machine. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the machine containing the extension. Required. - :type virtual_machine_name: str - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MachineExtension or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.connectedvmware.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.MachineExtensionsListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("MachineExtensionsListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/extensions" - } diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_operations.py index 5d8a552260d5..1a9eab0ef44d 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_operations.py @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,9 +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: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,9 +86,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationsList] = kwargs.pop("cls", None) error_map = { @@ -146,8 +137,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_resource_pools_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_resource_pools_operations.py index c63c502c0139..4adf2f070df7 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_resource_pools_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_resource_pools_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -66,7 +60,7 @@ def build_create_request( "resourcePoolName": _SERIALIZER.url("resource_pool_name", resource_pool_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -85,9 +79,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +93,7 @@ def build_get_request( "resourcePoolName": _SERIALIZER.url("resource_pool_name", resource_pool_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -118,9 +110,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -135,7 +125,7 @@ def build_update_request( "resourcePoolName": _SERIALIZER.url("resource_pool_name", resource_pool_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -159,9 +149,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -175,7 +163,7 @@ def build_delete_request( "resourcePoolName": _SERIALIZER.url("resource_pool_name", resource_pool_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -192,9 +180,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -205,7 +191,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -220,9 +206,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -235,7 +219,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -283,16 +267,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.ResourcePool] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -315,8 +297,9 @@ def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -431,7 +414,8 @@ def begin_create( :type resource_group_name: str :param resource_pool_name: Name of the resourcePool. Required. :type resource_pool_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a ResourcePool type or a IO type. Default value is + None. :type body: ~azure.mgmt.connectedvmware.models.ResourcePool or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -452,9 +436,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.ResourcePool] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -527,9 +509,7 @@ def get(self, resource_group_name: str, resource_pool_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResourcePool] = kwargs.pop("cls", None) request = build_get_request( @@ -544,8 +524,9 @@ def get(self, resource_group_name: str, resource_pool_name: str, **kwargs: Any) request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -640,8 +621,8 @@ def update( :type resource_group_name: str :param resource_pool_name: Name of the resourcePool. Required. :type resource_pool_name: str - :param body: Resource properties to update. Is either a model type or a IO type. Default value - is None. + :param body: Resource properties to update. Is either a ResourcePatch type or a IO type. + Default value is None. :type body: ~azure.mgmt.connectedvmware.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -662,16 +643,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.ResourcePool] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -694,8 +673,9 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -730,9 +710,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -748,8 +726,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -759,8 +738,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/resourcePools/{resourcePoolName}" @@ -795,9 +778,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -852,9 +833,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.ResourcePool"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResourcePoolsList] = kwargs.pop("cls", None) error_map = { @@ -906,8 +885,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -938,9 +918,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResourcePoolsList] = kwargs.pop("cls", None) error_map = { @@ -993,8 +971,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_vcenters_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_vcenters_operations.py index 161ad15499e1..7636bbfd18fa 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_vcenters_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_vcenters_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -66,7 +60,7 @@ def build_create_request( "vcenterName": _SERIALIZER.url("vcenter_name", vcenter_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,9 +77,7 @@ def build_get_request(resource_group_name: str, vcenter_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +91,7 @@ def build_get_request(resource_group_name: str, vcenter_name: str, subscription_ "vcenterName": _SERIALIZER.url("vcenter_name", vcenter_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -116,9 +108,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -133,7 +123,7 @@ def build_update_request( "vcenterName": _SERIALIZER.url("vcenter_name", vcenter_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -152,9 +142,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -168,7 +156,7 @@ def build_delete_request( "vcenterName": _SERIALIZER.url("vcenter_name", vcenter_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -185,9 +173,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -198,7 +184,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -213,9 +199,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -228,7 +212,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -276,16 +260,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VCenter] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -308,8 +290,9 @@ def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -422,7 +405,7 @@ def begin_create( :type resource_group_name: str :param vcenter_name: Name of the vCenter. Required. :type vcenter_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a VCenter type or a IO type. Default value is None. :type body: ~azure.mgmt.connectedvmware.models.VCenter or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -442,9 +425,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VCenter] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -517,9 +498,7 @@ def get(self, resource_group_name: str, vcenter_name: str, **kwargs: Any) -> _mo _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VCenter] = kwargs.pop("cls", None) request = build_get_request( @@ -534,8 +513,9 @@ def get(self, resource_group_name: str, vcenter_name: str, **kwargs: Any) -> _mo request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -630,8 +610,8 @@ def update( :type resource_group_name: str :param vcenter_name: Name of the vCenter. Required. :type vcenter_name: str - :param body: Resource properties to update. Is either a model type or a IO type. Default value - is None. + :param body: Resource properties to update. Is either a ResourcePatch type or a IO type. + Default value is None. :type body: ~azure.mgmt.connectedvmware.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -652,16 +632,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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.VCenter] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -684,8 +662,9 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -720,9 +699,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -738,8 +715,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -749,8 +727,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/vcenters/{vcenterName}" @@ -785,9 +767,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -842,9 +822,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.VCenter"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VCentersList] = kwargs.pop("cls", None) error_map = { @@ -896,8 +874,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -928,9 +907,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VCentersList] = kwargs.pop("cls", None) error_map = { @@ -983,8 +960,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_virtual_machine_instances_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_virtual_machine_instances_operations.py new file mode 100644 index 000000000000..901747033fc6 --- /dev/null +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_virtual_machine_instances_operations.py @@ -0,0 +1,1423 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_or_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-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default" + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_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-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default" + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_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-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default" + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_uri: str, *, delete_from_host: Optional[bool] = None, force: Optional[bool] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default" + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if delete_from_host is not None: + _params["deleteFromHost"] = _SERIALIZER.query("delete_from_host", delete_from_host, "bool") + if force is not None: + _params["force"] = _SERIALIZER.query("force", force, "bool") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +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-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances" + ) + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_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-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/stop" + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +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-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/start", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +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-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/restart", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class VirtualMachineInstancesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.connectedvmware.AzureArcVMwareManagementServiceAPI`'s + :attr:`virtual_machine_instances` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _create_or_update_initial( + self, resource_uri: str, body: Optional[Union[_models.VirtualMachineInstance, IO]] = None, **kwargs: Any + ) -> _models.VirtualMachineInstance: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", 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) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "VirtualMachineInstance") + else: + _json = None + + request = build_create_or_update_request( + resource_uri=resource_uri, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + _create_or_update_initial.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default" + } + + @overload + def begin_create_or_update( + self, + resource_uri: str, + body: Optional[_models.VirtualMachineInstance] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualMachineInstance]: + """Implements virtual machine PUT method. + + The operation to create or update a virtual machine instance. Please note some properties can + be set only during virtual machine instance creation. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Request payload. Default value is None. + :type body: ~azure.mgmt.connectedvmware.models.VirtualMachineInstance + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either VirtualMachineInstance or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.connectedvmware.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, resource_uri: str, body: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.VirtualMachineInstance]: + """Implements virtual machine PUT method. + + The operation to create or update a virtual machine instance. Please note some properties can + be set only during virtual machine instance creation. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Request payload. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either VirtualMachineInstance or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.connectedvmware.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, resource_uri: str, body: Optional[Union[_models.VirtualMachineInstance, IO]] = None, **kwargs: Any + ) -> LROPoller[_models.VirtualMachineInstance]: + """Implements virtual machine PUT method. + + The operation to create or update a virtual machine instance. Please note some properties can + be set only during virtual machine instance creation. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Request payload. Is either a VirtualMachineInstance type or a IO type. Default + value is None. + :type body: ~azure.mgmt.connectedvmware.models.VirtualMachineInstance or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either VirtualMachineInstance or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.connectedvmware.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualMachineInstance] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_uri=resource_uri, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default" + } + + @distributed_trace + def get(self, resource_uri: str, **kwargs: Any) -> _models.VirtualMachineInstance: + """Gets a virtual machine. + + Retrieves information about a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineInstance or the result of cls(response) + :rtype: ~azure.mgmt.connectedvmware.models.VirtualMachineInstance + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualMachineInstance] = kwargs.pop("cls", None) + + request = build_get_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {"url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default"} + + def _update_initial( + self, resource_uri: str, body: Optional[Union[_models.VirtualMachineInstanceUpdate, IO]] = None, **kwargs: Any + ) -> Optional[_models.VirtualMachineInstance]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", 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) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "VirtualMachineInstanceUpdate") + else: + _json = None + + request = build_update_request( + resource_uri=resource_uri, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + 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")) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default" + } + + @overload + def begin_update( + self, + resource_uri: str, + body: Optional[_models.VirtualMachineInstanceUpdate] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.VirtualMachineInstance]: + """Updates a virtual machine. + + The operation to update a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Resource properties to update. Default value is None. + :type body: ~azure.mgmt.connectedvmware.models.VirtualMachineInstanceUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either VirtualMachineInstance or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.connectedvmware.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, resource_uri: str, body: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.VirtualMachineInstance]: + """Updates a virtual machine. + + The operation to update a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Resource properties to update. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either VirtualMachineInstance or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.connectedvmware.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, resource_uri: str, body: Optional[Union[_models.VirtualMachineInstanceUpdate, IO]] = None, **kwargs: Any + ) -> LROPoller[_models.VirtualMachineInstance]: + """Updates a virtual machine. + + The operation to update a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Resource properties to update. Is either a VirtualMachineInstanceUpdate type or a + IO type. Default value is None. + :type body: ~azure.mgmt.connectedvmware.models.VirtualMachineInstanceUpdate or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either VirtualMachineInstance or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.connectedvmware.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.VirtualMachineInstance] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_uri=resource_uri, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("VirtualMachineInstance", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_update.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, resource_uri: str, delete_from_host: Optional[bool] = None, force: Optional[bool] = None, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_uri=resource_uri, + delete_from_host=delete_from_host, + force=force, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + 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 == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default" + } + + @distributed_trace + def begin_delete( + self, resource_uri: str, delete_from_host: Optional[bool] = None, force: Optional[bool] = None, **kwargs: Any + ) -> LROPoller[None]: + """Deletes an virtual machine. + + The operation to delete a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param delete_from_host: Whether to delete the VM from the vCenter. Default value is None. + :type delete_from_host: bool + :param force: Whether force delete was specified. Default value is None. + :type force: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _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) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_uri=resource_uri, + delete_from_host=delete_from_host, + force=force, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default" + } + + @distributed_trace + def list(self, resource_uri: str, **kwargs: Any) -> Iterable["_models.VirtualMachineInstance"]: + """Implements List virtual machine instances. + + Lists all of the virtual machine instances within the specified parent resource. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineInstance or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.connectedvmware.models.VirtualMachineInstance] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VirtualMachineInstancesList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("VirtualMachineInstancesList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = {"url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances"} + + def _stop_initial( # pylint: disable=inconsistent-return-statements + self, resource_uri: str, body: Optional[Union[_models.StopVirtualMachineOptions, IO]] = None, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(body, (IOBase, bytes)): + _content = body + else: + if body is not None: + _json = self._serialize.body(body, "StopVirtualMachineOptions") + else: + _json = None + + request = build_stop_request( + resource_uri=resource_uri, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._stop_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + 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 = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _stop_initial.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/stop" + } + + @overload + def begin_stop( + self, + resource_uri: str, + body: Optional[_models.StopVirtualMachineOptions] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Implements the operation to stop a virtual machine. + + The operation to power off (stop) a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Virtualmachine stop action payload. Default value is None. + :type body: ~azure.mgmt.connectedvmware.models.StopVirtualMachineOptions + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_stop( + self, resource_uri: str, body: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[None]: + """Implements the operation to stop a virtual machine. + + The operation to power off (stop) a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Virtualmachine stop action payload. Default value is None. + :type body: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_stop( + self, resource_uri: str, body: Optional[Union[_models.StopVirtualMachineOptions, IO]] = None, **kwargs: Any + ) -> LROPoller[None]: + """Implements the operation to stop a virtual machine. + + The operation to power off (stop) a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Virtualmachine stop action payload. Is either a StopVirtualMachineOptions type or + a IO type. Default value is None. + :type body: ~azure.mgmt.connectedvmware.models.StopVirtualMachineOptions or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + 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) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._stop_initial( # type: ignore + resource_uri=resource_uri, + body=body, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_stop.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/stop" + } + + def _start_initial( # pylint: disable=inconsistent-return-statements + self, resource_uri: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_start_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self._start_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + 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 = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _start_initial.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/start" + } + + @distributed_trace + def begin_start(self, resource_uri: str, **kwargs: Any) -> LROPoller[None]: + """Implements the operation to start a virtual machine. + + The operation to start a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _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) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._start_initial( # type: ignore + resource_uri=resource_uri, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_start.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/start" + } + + def _restart_initial( # pylint: disable=inconsistent-return-statements + self, resource_uri: str, **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_restart_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self._restart_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + 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 = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + if cls: + return cls(pipeline_response, None, response_headers) + + _restart_initial.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/restart" + } + + @distributed_trace + def begin_restart(self, resource_uri: str, **kwargs: Any) -> LROPoller[None]: + """Implements the operation to restart a virtual machine. + + The operation to restart a virtual machine instance. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _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) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._restart_initial( # type: ignore + resource_uri=resource_uri, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_restart.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/restart" + } diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_virtual_machine_templates_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_virtual_machine_templates_operations.py index f22625799224..dece5470875f 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_virtual_machine_templates_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_virtual_machine_templates_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -68,7 +62,7 @@ def build_create_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -87,9 +81,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -105,7 +97,7 @@ def build_get_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -122,9 +114,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -141,7 +131,7 @@ def build_update_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -165,9 +155,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -183,7 +171,7 @@ def build_delete_request( ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -200,9 +188,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -214,7 +200,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -229,9 +215,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -244,7 +228,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -292,16 +276,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -324,8 +306,9 @@ def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -442,7 +425,8 @@ def begin_create( :type resource_group_name: str :param virtual_machine_template_name: Name of the virtual machine template resource. Required. :type virtual_machine_template_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a VirtualMachineTemplate type or a IO type. Default + value is None. :type body: ~azure.mgmt.connectedvmware.models.VirtualMachineTemplate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -464,9 +448,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -541,9 +523,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachineTemplate] = kwargs.pop("cls", None) request = build_get_request( @@ -558,8 +538,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -654,8 +635,8 @@ def update( :type resource_group_name: str :param virtual_machine_template_name: Name of the virtual machine template resource. Required. :type virtual_machine_template_name: str - :param body: Resource properties to update. Is either a model type or a IO type. Default value - is None. + :param body: Resource properties to update. Is either a ResourcePatch type or a IO type. + Default value is None. :type body: ~azure.mgmt.connectedvmware.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -676,16 +657,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -708,8 +687,9 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -744,9 +724,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -762,8 +740,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -773,8 +752,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineTemplates/{virtualMachineTemplateName}" @@ -809,9 +792,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -867,9 +848,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.VirtualMachineTemplate"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachineTemplatesList] = kwargs.pop("cls", None) error_map = { @@ -921,8 +900,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -958,9 +938,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualMachineTemplatesList] = kwargs.pop("cls", None) error_map = { @@ -1013,8 +991,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_virtual_machines_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_virtual_machines_operations.py deleted file mode 100644 index 6a5eb2853756..000000000000 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_virtual_machines_operations.py +++ /dev/null @@ -1,2110 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request, _format_url_section - -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_assess_patches_request( - resource_group_name: str, virtual_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/assessPatches", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_install_patches_request( - resource_group_name: str, virtual_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/installPatches", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, virtual_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, virtual_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, virtual_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - virtual_machine_name: str, - subscription_id: str, - *, - retain: Optional[bool] = None, - force: Optional[bool] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if retain is not None: - _params["retain"] = _SERIALIZER.query("retain", retain, "bool") - if force is not None: - _params["force"] = _SERIALIZER.query("force", force, "bool") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request( - resource_group_name: str, virtual_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, virtual_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_restart_request( - resource_group_name: str, virtual_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/restart", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_all_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines" - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - } - - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class VirtualMachinesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.connectedvmware.AzureArcVMwareManagementServiceAPI`'s - :attr:`virtual_machines` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - def _assess_patches_initial( - self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any - ) -> Optional[_models.VirtualMachineAssessPatchesResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[Optional[_models.VirtualMachineAssessPatchesResult]] = kwargs.pop("cls", None) - - request = build_assess_patches_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._assess_patches_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("VirtualMachineAssessPatchesResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _assess_patches_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/assessPatches" - } - - @distributed_trace - def begin_assess_patches( - self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any - ) -> LROPoller[_models.VirtualMachineAssessPatchesResult]: - """The operation to assess patches on a vSphere VMware machine identity in Azure. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the vSphere VMware machine. Required. - :type virtual_machine_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineAssessPatchesResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.connectedvmware.models.VirtualMachineAssessPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualMachineAssessPatchesResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._assess_patches_initial( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineAssessPatchesResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_assess_patches.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/assessPatches" - } - - def _install_patches_initial( - self, - resource_group_name: str, - virtual_machine_name: str, - install_patches_input: Union[_models.VirtualMachineInstallPatchesParameters, IO], - **kwargs: Any - ) -> Optional[_models.VirtualMachineInstallPatchesResult]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = 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.VirtualMachineInstallPatchesResult]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(install_patches_input, (IO, bytes)): - _content = install_patches_input - else: - _json = self._serialize.body(install_patches_input, "VirtualMachineInstallPatchesParameters") - - request = build_install_patches_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._install_patches_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("VirtualMachineInstallPatchesResult", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _install_patches_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/installPatches" - } - - @overload - def begin_install_patches( - self, - resource_group_name: str, - virtual_machine_name: str, - install_patches_input: _models.VirtualMachineInstallPatchesParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineInstallPatchesResult]: - """The operation to install patches on a vSphere VMware machine identity in Azure. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the vSphere VMware machine. Required. - :type virtual_machine_name: str - :param install_patches_input: Input for InstallPatches as directly received by the API. - Required. - :type install_patches_input: - ~azure.mgmt.connectedvmware.models.VirtualMachineInstallPatchesParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineInstallPatchesResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.connectedvmware.models.VirtualMachineInstallPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_install_patches( - self, - resource_group_name: str, - virtual_machine_name: str, - install_patches_input: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineInstallPatchesResult]: - """The operation to install patches on a vSphere VMware machine identity in Azure. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the vSphere VMware machine. Required. - :type virtual_machine_name: str - :param install_patches_input: Input for InstallPatches as directly received by the API. - Required. - :type install_patches_input: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineInstallPatchesResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.connectedvmware.models.VirtualMachineInstallPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_install_patches( - self, - resource_group_name: str, - virtual_machine_name: str, - install_patches_input: Union[_models.VirtualMachineInstallPatchesParameters, IO], - **kwargs: Any - ) -> LROPoller[_models.VirtualMachineInstallPatchesResult]: - """The operation to install patches on a vSphere VMware machine identity in Azure. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param virtual_machine_name: The name of the vSphere VMware machine. Required. - :type virtual_machine_name: str - :param install_patches_input: Input for InstallPatches as directly received by the API. Is - either a model type or a IO type. Required. - :type install_patches_input: - ~azure.mgmt.connectedvmware.models.VirtualMachineInstallPatchesParameters or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachineInstallPatchesResult or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.connectedvmware.models.VirtualMachineInstallPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = 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.VirtualMachineInstallPatchesResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._install_patches_initial( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - install_patches_input=install_patches_input, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachineInstallPatchesResult", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_install_patches.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/installPatches" - } - - def _create_or_update_initial( - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[Union[_models.VirtualMachine, IO]] = None, - **kwargs: Any - ) -> _models.VirtualMachine: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = 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.VirtualMachine] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IO, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "VirtualMachine") - else: - _json = None - - request = build_create_or_update_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._create_or_update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - 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("VirtualMachine", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("VirtualMachine", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}" - } - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[_models.VirtualMachine] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachine]: - """Implements virtual machine PUT method. - - Create Or Update virtual machine. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the virtual machine resource. Required. - :type virtual_machine_name: str - :param body: Request payload. Default value is None. - :type body: ~azure.mgmt.connectedvmware.models.VirtualMachine - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.connectedvmware.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachine]: - """Implements virtual machine PUT method. - - Create Or Update virtual machine. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the virtual machine resource. Required. - :type virtual_machine_name: str - :param body: Request payload. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.connectedvmware.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[Union[_models.VirtualMachine, IO]] = None, - **kwargs: Any - ) -> LROPoller[_models.VirtualMachine]: - """Implements virtual machine PUT method. - - Create Or Update virtual machine. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the virtual machine resource. Required. - :type virtual_machine_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. - :type body: ~azure.mgmt.connectedvmware.models.VirtualMachine or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.connectedvmware.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = 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.VirtualMachine] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachine", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}" - } - - @distributed_trace - def get(self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any) -> _models.VirtualMachine: - """Gets a virtual machine. - - Implements virtual machine GET method. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the virtual machine resource. Required. - :type virtual_machine_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: VirtualMachine or the result of cls(response) - :rtype: ~azure.mgmt.connectedvmware.models.VirtualMachine - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None) - - request = build_get_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("VirtualMachine", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}" - } - - def _update_initial( - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[Union[_models.VirtualMachineUpdate, IO]] = None, - **kwargs: Any - ) -> Optional[_models.VirtualMachine]: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = 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.VirtualMachine]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IO, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "VirtualMachineUpdate") - else: - _json = None - - request = build_update_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - 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 - if response.status_code == 200: - deserialized = self._deserialize("VirtualMachine", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("VirtualMachine", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}" - } - - @overload - def begin_update( - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[_models.VirtualMachineUpdate] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachine]: - """Updates a virtual machine. - - API to update certain properties of the virtual machine resource. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the virtual machine resource. Required. - :type virtual_machine_name: str - :param body: Resource properties to update. Default value is None. - :type body: ~azure.mgmt.connectedvmware.models.VirtualMachineUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.connectedvmware.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.VirtualMachine]: - """Updates a virtual machine. - - API to update certain properties of the virtual machine resource. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the virtual machine resource. Required. - :type virtual_machine_name: str - :param body: Resource properties to update. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.connectedvmware.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[Union[_models.VirtualMachineUpdate, IO]] = None, - **kwargs: Any - ) -> LROPoller[_models.VirtualMachine]: - """Updates a virtual machine. - - API to update certain properties of the virtual machine resource. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the virtual machine resource. Required. - :type virtual_machine_name: str - :param body: Resource properties to update. Is either a model type or a IO type. Default value - is None. - :type body: ~azure.mgmt.connectedvmware.models.VirtualMachineUpdate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either VirtualMachine or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.connectedvmware.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = 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.VirtualMachine] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("VirtualMachine", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - virtual_machine_name: str, - retain: Optional[bool] = None, - force: Optional[bool] = None, - **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_delete_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - retain=retain, - force=force, - api_version=api_version, - template_url=self._delete_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}" - } - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - virtual_machine_name: str, - retain: Optional[bool] = None, - force: Optional[bool] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Deletes an virtual machine. - - Implements virtual machine DELETE method. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the virtual machine resource. Required. - :type virtual_machine_name: str - :param retain: Whether to just disable the VM from azure and retain the VM in the VMM. Default - value is None. - :type retain: bool - :param force: Whether force delete was specified. Default value is None. - :type force: bool - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - retain=retain, - force=force, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}" - } - - def _stop_initial( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[Union[_models.StopVirtualMachineOptions, IO]] = None, - **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = 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) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IO, bytes)): - _content = body - else: - if body is not None: - _json = self._serialize.body(body, "StopVirtualMachineOptions") - else: - _json = None - - request = build_stop_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._stop_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _stop_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/stop" - } - - @overload - def begin_stop( - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[_models.StopVirtualMachineOptions] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Implements the operation to stop a virtual machine. - - Stop virtual machine. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the virtual machine resource. Required. - :type virtual_machine_name: str - :param body: Virtualmachine stop action payload. Default value is None. - :type body: ~azure.mgmt.connectedvmware.models.StopVirtualMachineOptions - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_stop( - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Implements the operation to stop a virtual machine. - - Stop virtual machine. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the virtual machine resource. Required. - :type virtual_machine_name: str - :param body: Virtualmachine stop action payload. Default value is None. - :type body: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_stop( - self, - resource_group_name: str, - virtual_machine_name: str, - body: Optional[Union[_models.StopVirtualMachineOptions, IO]] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Implements the operation to stop a virtual machine. - - Stop virtual machine. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the virtual machine resource. Required. - :type virtual_machine_name: str - :param body: Virtualmachine stop action payload. Is either a model type or a IO type. Default - value is None. - :type body: ~azure.mgmt.connectedvmware.models.StopVirtualMachineOptions or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = 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) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._stop_initial( # type: ignore - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - body=body, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_stop.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/stop" - } - - def _start_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_start_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._start_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _start_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/start" - } - - @distributed_trace - def begin_start(self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any) -> LROPoller[None]: - """Implements the operation to start a virtual machine. - - Start virtual machine. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the virtual machine resource. Required. - :type virtual_machine_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_initial( # type: ignore - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_start.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/start" - } - - def _restart_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any - ) -> None: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - - request = build_restart_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self._restart_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _restart_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/restart" - } - - @distributed_trace - def begin_restart(self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any) -> LROPoller[None]: - """Implements the operation to restart a virtual machine. - - Restart virtual machine. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the virtual machine resource. Required. - :type virtual_machine_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._restart_initial( # type: ignore - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_restart.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/restart" - } - - @distributed_trace - def list_all(self, **kwargs: Any) -> Iterable["_models.VirtualMachine"]: - """Implements GET virtualMachines in a subscription. - - List of virtualMachines in a subscription. - - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.connectedvmware.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualMachinesList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_all_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list_all.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualMachinesList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list_all.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines" - } - - @distributed_trace - def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.VirtualMachine"]: - """Implements GET virtualMachines in a resource group. - - List of virtualMachines in a resource group. - - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either VirtualMachine or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.connectedvmware.models.VirtualMachine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - cls: ClsType[_models.VirtualMachinesList] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("VirtualMachinesList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines" - } diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_virtual_networks_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_virtual_networks_operations.py index 848e03a316ff..a6fb88f40449 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_virtual_networks_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_virtual_networks_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,9 +45,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -66,7 +60,7 @@ def build_create_request( "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -85,9 +79,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,7 +93,7 @@ def build_get_request( "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -118,9 +110,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -135,7 +125,7 @@ def build_update_request( "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -159,9 +149,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -175,7 +163,7 @@ def build_delete_request( "virtualNetworkName": _SERIALIZER.url("virtual_network_name", virtual_network_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -192,9 +180,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -205,7 +191,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -220,9 +206,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -235,7 +219,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -283,16 +267,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -315,8 +297,9 @@ def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -431,7 +414,8 @@ def begin_create( :type resource_group_name: str :param virtual_network_name: Name of the virtual network resource. Required. :type virtual_network_name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param body: Request payload. Is either a VirtualNetwork type or a IO type. Default value is + None. :type body: ~azure.mgmt.connectedvmware.models.VirtualNetwork or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -452,9 +436,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -527,9 +509,7 @@ def get(self, resource_group_name: str, virtual_network_name: str, **kwargs: Any _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualNetwork] = kwargs.pop("cls", None) request = build_get_request( @@ -544,8 +524,9 @@ def get(self, resource_group_name: str, virtual_network_name: str, **kwargs: Any request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -640,8 +621,8 @@ def update( :type resource_group_name: str :param virtual_network_name: Name of the virtual network resource. Required. :type virtual_network_name: str - :param body: Resource properties to update. Is either a model type or a IO type. Default value - is None. + :param body: Resource properties to update. Is either a ResourcePatch type or a IO type. + Default value is None. :type body: ~azure.mgmt.connectedvmware.models.ResourcePatch or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -662,16 +643,14 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -694,8 +673,9 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -730,9 +710,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( @@ -748,8 +726,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -759,8 +738,12 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualNetworks/{virtualNetworkName}" @@ -795,9 +778,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -852,9 +833,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.VirtualNetwork"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualNetworksList] = kwargs.pop("cls", None) error_map = { @@ -906,8 +885,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -940,9 +920,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VirtualNetworksList] = kwargs.pop("cls", None) error_map = { @@ -995,8 +973,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_guest_agents_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_vm_instance_guest_agents_operations.py similarity index 68% rename from sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_guest_agents_operations.py rename to sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_vm_instance_guest_agents_operations.py index 7d2db93cfded..533ed2f9194b 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_guest_agents_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_vm_instance_guest_agents_operations.py @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import AzureArcVMwareManagementServiceAPIMixinABC, _convert_request, _format_url_section +from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,31 +39,24 @@ _SERIALIZER.client_side_validation = False -def build_create_request( - resource_group_name: str, virtual_machine_name: str, name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +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: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/guestAgents/{name}", + "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/guestAgents/default", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), - "name": _SERIALIZER.url("name", name, "str"), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -80,30 +69,23 @@ def build_create_request( return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) -def build_get_request( - resource_group_name: str, virtual_machine_name: str, name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +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: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/guestAgents/{name}", + "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/guestAgents/default", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), - "name": _SERIALIZER.url("name", name, "str"), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -114,30 +96,23 @@ def build_get_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_delete_request( - resource_group_name: str, virtual_machine_name: str, name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +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: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/guestAgents/{name}", + "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/guestAgents/default", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), - "name": _SERIALIZER.url("name", name, "str"), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -148,29 +123,23 @@ def build_delete_request( return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) -def build_list_request( - resource_group_name: str, virtual_machine_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: +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: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-15-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/guestAgents", + "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/guestAgents", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "virtualMachineName": _SERIALIZER.url("virtual_machine_name", virtual_machine_name, "str"), + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -181,14 +150,14 @@ def build_list_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -class GuestAgentsOperations: +class VMInstanceGuestAgentsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.connectedvmware.AzureArcVMwareManagementServiceAPI`'s - :attr:`guest_agents` attribute. + :attr:`vm_instance_guest_agents` attribute. """ models = _models @@ -201,12 +170,7 @@ def __init__(self, *args, **kwargs): self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") def _create_initial( - self, - resource_group_name: str, - virtual_machine_name: str, - name: str, - body: Optional[Union[_models.GuestAgent, IO]] = None, - **kwargs: Any + self, resource_uri: str, body: Optional[Union[_models.GuestAgent, IO]] = None, **kwargs: Any ) -> _models.GuestAgent: error_map = { 401: ClientAuthenticationError, @@ -219,16 +183,14 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) content_type = content_type or "application/json" _json = None _content = None - if isinstance(body, (IO, bytes)): + if isinstance(body, (IOBase, bytes)): _content = body else: if body is not None: @@ -237,10 +199,7 @@ def _create_initial( _json = None request = build_create_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - name=name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, content_type=content_type, json=_json, @@ -252,8 +211,9 @@ def _create_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -275,15 +235,13 @@ def _create_initial( return deserialized # type: ignore _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/guestAgents/{name}" + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/guestAgents/default" } @overload def begin_create( self, - resource_group_name: str, - virtual_machine_name: str, - name: str, + resource_uri: str, body: Optional[_models.GuestAgent] = None, *, content_type: str = "application/json", @@ -293,12 +251,9 @@ def begin_create( Create Or Update GuestAgent. - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param name: Name of the guestAgents. Required. - :type name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :param body: Request payload. Default value is None. :type body: ~azure.mgmt.connectedvmware.models.GuestAgent :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. @@ -319,25 +274,15 @@ def begin_create( @overload def begin_create( - self, - resource_group_name: str, - virtual_machine_name: str, - name: str, - body: Optional[IO] = None, - *, - content_type: str = "application/json", - **kwargs: Any + self, resource_uri: str, body: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GuestAgent]: """Implements GuestAgent PUT method. Create Or Update GuestAgent. - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param name: Name of the guestAgents. Required. - :type name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :param body: Request payload. Default value is None. :type body: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. @@ -358,24 +303,16 @@ def begin_create( @distributed_trace def begin_create( - self, - resource_group_name: str, - virtual_machine_name: str, - name: str, - body: Optional[Union[_models.GuestAgent, IO]] = None, - **kwargs: Any + self, resource_uri: str, body: Optional[Union[_models.GuestAgent, IO]] = None, **kwargs: Any ) -> LROPoller[_models.GuestAgent]: """Implements GuestAgent PUT method. Create Or Update GuestAgent. - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param name: Name of the guestAgents. Required. - :type name: str - :param body: Request payload. Is either a model type or a IO type. Default value is None. + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :param body: Request payload. Is either a GuestAgent type or a IO type. Default value is None. :type body: ~azure.mgmt.connectedvmware.models.GuestAgent or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -395,9 +332,7 @@ def begin_create( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -405,9 +340,7 @@ def begin_create( cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._create_initial( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - name=name, + resource_uri=resource_uri, body=body, api_version=api_version, content_type=content_type, @@ -442,21 +375,18 @@ def get_long_running_output(pipeline_response): return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/guestAgents/{name}" + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/guestAgents/default" } @distributed_trace - def get(self, resource_group_name: str, virtual_machine_name: str, name: str, **kwargs: Any) -> _models.GuestAgent: + def get(self, resource_uri: str, **kwargs: Any) -> _models.GuestAgent: """Gets GuestAgent. Implements GuestAgent GET method. - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param name: Name of the GuestAgent. Required. - :type name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response :return: GuestAgent or the result of cls(response) :rtype: ~azure.mgmt.connectedvmware.models.GuestAgent @@ -473,16 +403,11 @@ def get(self, resource_group_name: str, virtual_machine_name: str, name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GuestAgent] = kwargs.pop("cls", None) request = build_get_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - name=name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, template_url=self.get.metadata["url"], headers=_headers, @@ -491,8 +416,9 @@ def get(self, resource_group_name: str, virtual_machine_name: str, name: str, ** request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -510,11 +436,11 @@ def get(self, resource_group_name: str, virtual_machine_name: str, name: str, ** return deserialized get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/guestAgents/{name}" + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/guestAgents/default" } def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, virtual_machine_name: str, name: str, **kwargs: Any + self, resource_uri: str, **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -527,16 +453,11 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - name=name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, template_url=self._delete_initial.metadata["url"], headers=_headers, @@ -545,38 +466,38 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: 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 == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, response_headers) _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/guestAgents/{name}" + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/guestAgents/default" } @distributed_trace - def begin_delete( - self, resource_group_name: str, virtual_machine_name: str, name: str, **kwargs: Any - ) -> LROPoller[None]: + def begin_delete(self, resource_uri: str, **kwargs: Any) -> LROPoller[None]: """Deletes an GuestAgent. Implements GuestAgent DELETE method. - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str - :param name: Name of the GuestAgent. Required. - :type name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this @@ -592,18 +513,14 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - name=name, + resource_uri=resource_uri, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, @@ -632,21 +549,18 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/guestAgents/{name}" + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/guestAgents/default" } @distributed_trace - def list( - self, resource_group_name: str, virtual_machine_name: str, **kwargs: Any - ) -> Iterable["_models.GuestAgent"]: + def list(self, resource_uri: str, **kwargs: Any) -> Iterable["_models.GuestAgent"]: """Implements GET GuestAgent in a vm. Returns the list of GuestAgent of the given vm. - :param resource_group_name: The Resource Group Name. Required. - :type resource_group_name: str - :param virtual_machine_name: Name of the vm. Required. - :type virtual_machine_name: str + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either GuestAgent or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.connectedvmware.models.GuestAgent] @@ -655,9 +569,7 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-15-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GuestAgentList] = kwargs.pop("cls", None) error_map = { @@ -672,9 +584,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( - resource_group_name=resource_group_name, - virtual_machine_name=virtual_machine_name, - subscription_id=self._config.subscription_id, + resource_uri=resource_uri, api_version=api_version, template_url=self.list.metadata["url"], headers=_headers, @@ -711,8 +621,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -726,5 +637,5 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachines/{virtualMachineName}/guestAgents" + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/guestAgents" } diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_vm_instance_hybrid_identity_metadata_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_vm_instance_hybrid_identity_metadata_operations.py new file mode 100644 index 000000000000..a25b1d3548d7 --- /dev/null +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/azure/mgmt/connectedvmware/operations/_vm_instance_hybrid_identity_metadata_operations.py @@ -0,0 +1,261 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request(resource_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-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/hybridIdentityMetadata/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_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-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/hybridIdentityMetadata", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceUri": _SERIALIZER.url("resource_uri", resource_uri, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class VmInstanceHybridIdentityMetadataOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.connectedvmware.AzureArcVMwareManagementServiceAPI`'s + :attr:`vm_instance_hybrid_identity_metadata` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, resource_uri: str, **kwargs: Any) -> _models.VmInstanceHybridIdentityMetadata: + """Gets HybridIdentityMetadata. + + Implements HybridIdentityMetadata GET method. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VmInstanceHybridIdentityMetadata or the result of cls(response) + :rtype: ~azure.mgmt.connectedvmware.models.VmInstanceHybridIdentityMetadata + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VmInstanceHybridIdentityMetadata] = kwargs.pop("cls", None) + + request = build_get_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("VmInstanceHybridIdentityMetadata", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/hybridIdentityMetadata/default" + } + + @distributed_trace + def list(self, resource_uri: str, **kwargs: Any) -> Iterable["_models.VmInstanceHybridIdentityMetadata"]: + """Implements GET HybridIdentityMetadata in a vm. + + Returns the list of HybridIdentityMetadata of the given vm. + + :param resource_uri: The fully qualified Azure Resource manager identifier of the Hybrid + Compute machine resource to be extended. Required. + :type resource_uri: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VmInstanceHybridIdentityMetadata or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.connectedvmware.models.VmInstanceHybridIdentityMetadata] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.VmInstanceHybridIdentityMetadataList] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_uri=resource_uri, + api_version=api_version, + template_url=self.list.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("VmInstanceHybridIdentityMetadataList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list.metadata = { + "url": "/{resourceUri}/providers/Microsoft.ConnectedVMwarevSphere/virtualMachineInstances/default/hybridIdentityMetadata" + } diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_cluster.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_cluster.py index e34c426554ed..905432c26cd2 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_cluster.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_cluster.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/CreateCluster.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/CreateCluster.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_datastore.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_datastore.py index 9a711f5f69f0..35440ebfec0b 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_datastore.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_datastore.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/CreateDatastore.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/CreateDatastore.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_host.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_host.py index 23dba81d67eb..8f0f93d19a00 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_host.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_host.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/CreateHost.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/CreateHost.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_hybrid_identity_metadata.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_hybrid_identity_metadata.py deleted file mode 100644 index 40e0eed1233c..000000000000 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_hybrid_identity_metadata.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.connectedvmware import AzureArcVMwareManagementServiceAPI - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-connectedvmware -# USAGE - python create_hybrid_identity_metadata.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 = AzureArcVMwareManagementServiceAPI( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.hybrid_identity_metadata.create( - resource_group_name="testrg", - virtual_machine_name="ContosoVm", - metadata_name="default", - ) - print(response) - - -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/CreateHybridIdentityMetadata.json -if __name__ == "__main__": - main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_inventory_item.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_inventory_item.py index fd450fd077c7..8305b99cc6bf 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_inventory_item.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_inventory_item.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/CreateInventoryItem.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/CreateInventoryItem.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_resource_pool.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_resource_pool.py index 9f1966d15716..718ba1329aa8 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_resource_pool.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_resource_pool.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/CreateResourcePool.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/CreateResourcePool.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_vcenter.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_vcenter.py index c0a742371d08..ab0190396d84 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_vcenter.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_vcenter.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/CreateVCenter.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/CreateVCenter.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_virtual_machine_instance.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_virtual_machine_instance.py new file mode 100644 index 000000000000..3305091439eb --- /dev/null +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_virtual_machine_instance.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.connectedvmware import AzureArcVMwareManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-connectedvmware +# USAGE + python create_virtual_machine_instance.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 = AzureArcVMwareManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.virtual_machine_instances.begin_create_or_update( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + ).result() + print(response) + + +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/CreateVirtualMachineInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_virtual_machine_template.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_virtual_machine_template.py index d499d9369e7b..8bffc397bfd5 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_virtual_machine_template.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_virtual_machine_template.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/CreateVirtualMachineTemplate.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/CreateVirtualMachineTemplate.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_virtual_network.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_virtual_network.py index de8850597708..4d7b83be0348 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_virtual_network.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_virtual_network.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/CreateVirtualNetwork.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/CreateVirtualNetwork.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_vm_instance_guest_agent.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_vm_instance_guest_agent.py new file mode 100644 index 000000000000..05ecf5d39a52 --- /dev/null +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_vm_instance_guest_agent.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.connectedvmware import AzureArcVMwareManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-connectedvmware +# USAGE + python create_vm_instance_guest_agent.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 = AzureArcVMwareManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.vm_instance_guest_agents.begin_create( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + ).result() + print(response) + + +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/CreateVMInstanceGuestAgent.json +if __name__ == "__main__": + main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_cluster.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_cluster.py index bca97514f946..801367b0f93d 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_cluster.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_cluster.py @@ -29,13 +29,12 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.clusters.begin_delete( + client.clusters.begin_delete( resource_group_name="testrg", cluster_name="HRCluster", ).result() - print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/DeleteCluster.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/DeleteCluster.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_datastore.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_datastore.py index 1304ca3c04f8..c2d7593a319f 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_datastore.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_datastore.py @@ -29,13 +29,12 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.datastores.begin_delete( + client.datastores.begin_delete( resource_group_name="testrg", datastore_name="HRDatastore", ).result() - print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/DeleteDatastore.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/DeleteDatastore.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_host.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_host.py index aa0232905106..ed687fc82d4a 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_host.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_host.py @@ -29,13 +29,12 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.hosts.begin_delete( + client.hosts.begin_delete( resource_group_name="testrg", host_name="HRHost", ).result() - print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/DeleteHost.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/DeleteHost.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_inventory_item.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_inventory_item.py index 78c72ca2c563..ca119cc99ef0 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_inventory_item.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_inventory_item.py @@ -29,14 +29,13 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.inventory_items.delete( + client.inventory_items.delete( resource_group_name="testrg", vcenter_name="ContosoVCenter", inventory_item_name="testItem", ) - print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/DeleteInventoryItem.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/DeleteInventoryItem.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_resource_pool.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_resource_pool.py index 30acd08d5092..62af3093fc20 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_resource_pool.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_resource_pool.py @@ -29,13 +29,12 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.resource_pools.begin_delete( + client.resource_pools.begin_delete( resource_group_name="testrg", resource_pool_name="HRPool", ).result() - print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/DeleteResourcePool.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/DeleteResourcePool.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_vcenter.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_vcenter.py index 79f3655cd1f4..09f285069317 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_vcenter.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_vcenter.py @@ -29,13 +29,12 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.vcenters.begin_delete( + client.vcenters.begin_delete( resource_group_name="testrg", vcenter_name="ContosoVCenter", ).result() - print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/DeleteVCenter.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/DeleteVCenter.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_virtual_machine.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_virtual_machine.py deleted file mode 100644 index 85217b86cff3..000000000000 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_virtual_machine.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.connectedvmware import AzureArcVMwareManagementServiceAPI - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-connectedvmware -# USAGE - python delete_virtual_machine.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 = AzureArcVMwareManagementServiceAPI( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.virtual_machines.begin_delete( - resource_group_name="testrg", - virtual_machine_name="DemoVM", - ).result() - print(response) - - -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/DeleteVirtualMachine.json -if __name__ == "__main__": - main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_virtual_machine.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_virtual_machine_instance.py similarity index 77% rename from sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_virtual_machine.py rename to sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_virtual_machine_instance.py index 2a87d9656688..337263cd9a0c 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_virtual_machine.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_virtual_machine_instance.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-connectedvmware # USAGE - python create_virtual_machine.py + python delete_virtual_machine_instance.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, @@ -26,16 +26,14 @@ def main(): client = AzureArcVMwareManagementServiceAPI( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.virtual_machines.begin_create_or_update( - resource_group_name="testrg", - virtual_machine_name="DemoVM", + client.virtual_machine_instances.begin_delete( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", ).result() - print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/CreateVirtualMachine.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/DeleteVirtualMachineInstance.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_virtual_machine_template.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_virtual_machine_template.py index 9e9c05b0fe98..ec382aed27fa 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_virtual_machine_template.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_virtual_machine_template.py @@ -29,13 +29,12 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.virtual_machine_templates.begin_delete( + client.virtual_machine_templates.begin_delete( resource_group_name="testrg", virtual_machine_template_name="WebFrontEndTemplate", ).result() - print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/DeleteVirtualMachineTemplate.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/DeleteVirtualMachineTemplate.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_virtual_network.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_virtual_network.py index 976002f1b108..6d3a851f538c 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_virtual_network.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_virtual_network.py @@ -29,13 +29,12 @@ def main(): subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", ) - response = client.virtual_networks.begin_delete( + client.virtual_networks.begin_delete( resource_group_name="testrg", virtual_network_name="ProdNetwork", ).result() - print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/DeleteVirtualNetwork.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/DeleteVirtualNetwork.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_guest_agent.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_vm_instance_guest_agent.py similarity index 77% rename from sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_guest_agent.py rename to sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_vm_instance_guest_agent.py index b3fdf3863dcc..892468416904 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_guest_agent.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_vm_instance_guest_agent.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-connectedvmware # USAGE - python create_guest_agent.py + python delete_vm_instance_guest_agent.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, @@ -26,17 +26,14 @@ def main(): client = AzureArcVMwareManagementServiceAPI( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.guest_agents.begin_create( - resource_group_name="testrg", - virtual_machine_name="ContosoVm", - name="default", + client.vm_instance_guest_agents.begin_delete( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", ).result() - print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/CreateGuestAgent.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/DeleteVMInstanceGuestAgent.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/extensions_upgrade.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/extensions_upgrade.py deleted file mode 100644 index 336cb7bc7041..000000000000 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/extensions_upgrade.py +++ /dev/null @@ -1,47 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.connectedvmware import AzureArcVMwareManagementServiceAPI - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-connectedvmware -# USAGE - python extensions_upgrade.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 = AzureArcVMwareManagementServiceAPI( - credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", - ) - - response = client.begin_upgrade_extensions( - resource_group_name="myResourceGroup", - virtual_machine_name="myMachine", - extension_upgrade_parameters={ - "extensionTargets": { - "Microsoft.Azure.Monitoring": {"targetVersion": "2.0"}, - "Microsoft.Compute.CustomScriptExtension": {"targetVersion": "1.10"}, - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/Extensions_Upgrade.json -if __name__ == "__main__": - main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_cluster.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_cluster.py index 3d9008d3971c..9d99ce5ea88d 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_cluster.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_cluster.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/GetCluster.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/GetCluster.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_datastore.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_datastore.py index 89b59de01aed..faeeb5261ba0 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_datastore.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_datastore.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/GetDatastore.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/GetDatastore.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_guest_agent.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_guest_agent.py deleted file mode 100644 index c502ab229c89..000000000000 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_guest_agent.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.connectedvmware import AzureArcVMwareManagementServiceAPI - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-connectedvmware -# USAGE - python get_guest_agent.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 = AzureArcVMwareManagementServiceAPI( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.guest_agents.get( - resource_group_name="testrg", - virtual_machine_name="ContosoVm", - name="default", - ) - print(response) - - -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/GetGuestAgent.json -if __name__ == "__main__": - main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_host.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_host.py index 4dd64ecceff7..b1304953549f 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_host.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_host.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/GetHost.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/GetHost.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_inventory_item.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_inventory_item.py index 2679f736a71d..72179f8fd250 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_inventory_item.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_inventory_item.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/GetInventoryItem.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/GetInventoryItem.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_resource_pool.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_resource_pool.py index e0b1968dc3ee..622d33d991dd 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_resource_pool.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_resource_pool.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/GetResourcePool.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/GetResourcePool.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_vcenter.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_vcenter.py index 3cdc2e756a43..74f6d93185e2 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_vcenter.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_vcenter.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/GetVCenter.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/GetVCenter.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_virtual_machine.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_virtual_machine.py deleted file mode 100644 index 2d2d89a34f1d..000000000000 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_virtual_machine.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.connectedvmware import AzureArcVMwareManagementServiceAPI - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-connectedvmware -# USAGE - python get_virtual_machine.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 = AzureArcVMwareManagementServiceAPI( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.virtual_machines.get( - resource_group_name="testrg", - virtual_machine_name="DemoVM", - ) - print(response) - - -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/GetVirtualMachine.json -if __name__ == "__main__": - main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_hybrid_identity_metadata.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_virtual_machine_instance.py similarity index 77% rename from sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_hybrid_identity_metadata.py rename to sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_virtual_machine_instance.py index 65f394824b82..77a1dae17f66 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_hybrid_identity_metadata.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_virtual_machine_instance.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-connectedvmware # USAGE - python get_hybrid_identity_metadata.py + python get_virtual_machine_instance.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, @@ -26,17 +26,15 @@ def main(): client = AzureArcVMwareManagementServiceAPI( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.hybrid_identity_metadata.get( - resource_group_name="testrg", - virtual_machine_name="ContosoVm", - metadata_name="default", + response = client.virtual_machine_instances.get( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", ) print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/GetHybridIdentityMetadata.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/GetVirtualMachineInstance.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_virtual_machine_template.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_virtual_machine_template.py index 058e707473a5..fb919ff9711e 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_virtual_machine_template.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_virtual_machine_template.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/GetVirtualMachineTemplate.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/GetVirtualMachineTemplate.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_virtual_network.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_virtual_network.py index 275bdd48edbe..ba205758cb86 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_virtual_network.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_virtual_network.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/GetVirtualNetwork.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/GetVirtualNetwork.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_extension.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_vm_instance_guest_agent.py similarity index 77% rename from sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_extension.py rename to sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_vm_instance_guest_agent.py index d70603c9b1f5..7539303619f0 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_extension.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_vm_instance_guest_agent.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-connectedvmware # USAGE - python get_extension.py + python get_vm_instance_guest_agent.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, @@ -26,17 +26,15 @@ def main(): client = AzureArcVMwareManagementServiceAPI( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="SUBSCRIPTION_ID", ) - response = client.machine_extensions.get( - resource_group_name="myResourceGroup", - virtual_machine_name="myMachine", - extension_name="CustomScriptExtension", + response = client.vm_instance_guest_agents.get( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", ) print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/GETExtension.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/GetVMInstanceGuestAgent.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_hybrid_identity_metadata.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_vm_instance_hybrid_identity_metadata.py similarity index 75% rename from sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_hybrid_identity_metadata.py rename to sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_vm_instance_hybrid_identity_metadata.py index cb272ffa995f..912460ad8699 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_hybrid_identity_metadata.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/get_vm_instance_hybrid_identity_metadata.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-connectedvmware # USAGE - python delete_hybrid_identity_metadata.py + python get_vm_instance_hybrid_identity_metadata.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, @@ -26,17 +26,15 @@ def main(): client = AzureArcVMwareManagementServiceAPI( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.hybrid_identity_metadata.delete( - resource_group_name="testrg", - virtual_machine_name="ContosoVm", - metadata_name="default", + response = client.vm_instance_hybrid_identity_metadata.get( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", ) print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/DeleteHybridIdentityMetadata.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/GetVmInstanceHybridIdentityMetadata.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_extension.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/hybrid_identity_metadata_list_by_vm_instance.py similarity index 75% rename from sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_extension.py rename to sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/hybrid_identity_metadata_list_by_vm_instance.py index 29822da4fd85..3b50a2a862df 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_extension.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/hybrid_identity_metadata_list_by_vm_instance.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-connectedvmware # USAGE - python list_extension.py + python hybrid_identity_metadata_list_by_vm_instance.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, @@ -26,17 +26,16 @@ def main(): client = AzureArcVMwareManagementServiceAPI( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="SUBSCRIPTION_ID", ) - response = client.machine_extensions.list( - resource_group_name="myResourceGroup", - virtual_machine_name="myMachine", + response = client.vm_instance_hybrid_identity_metadata.list( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", ) for item in response: print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/LISTExtension.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/HybridIdentityMetadata_ListByVmInstance.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/inventory_items_list_by_vcenter.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/inventory_items_list_by_vcenter.py index bc4ff3957b34..55ff56a1d4c0 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/inventory_items_list_by_vcenter.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/inventory_items_list_by_vcenter.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/InventoryItems_ListByVCenter.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/InventoryItems_ListByVCenter.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_clusters.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_clusters.py index 1b8d0d6ff8a9..747c6d2e2de3 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_clusters.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_clusters.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/ListClusters.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/ListClusters.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_clusters_by_resource_group.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_clusters_by_resource_group.py index 5fba75d28eaf..d745bd71e643 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_clusters_by_resource_group.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_clusters_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/ListClustersByResourceGroup.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/ListClustersByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_datastores.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_datastores.py index 86be50d13c2b..6f04dc020a7c 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_datastores.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_datastores.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/ListDatastores.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/ListDatastores.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_datastores_by_resource_group.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_datastores_by_resource_group.py index 14f72e1ab4ad..0f502c42d395 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_datastores_by_resource_group.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_datastores_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/ListDatastoresByResourceGroup.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/ListDatastoresByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_hosts.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_hosts.py index cf99a608b885..79fe72b92504 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_hosts.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_hosts.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/ListHosts.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/ListHosts.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_hosts_by_resource_group.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_hosts_by_resource_group.py index 4e14a01e0be9..6c490a66919d 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_hosts_by_resource_group.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_hosts_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/ListHostsByResourceGroup.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/ListHostsByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_operations.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_operations.py index 07f3251c0f98..e64100adf598 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_operations.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_operations.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/ListOperations.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/ListOperations.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_resource_pools.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_resource_pools.py index fd10bd54baa8..3afa17292ee4 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_resource_pools.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_resource_pools.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/ListResourcePools.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/ListResourcePools.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_resource_pools_by_resource_group.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_resource_pools_by_resource_group.py index 182d7a8f57ca..f3efc43b23f7 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_resource_pools_by_resource_group.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_resource_pools_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/ListResourcePoolsByResourceGroup.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/ListResourcePoolsByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_vcenters.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_vcenters.py index bdfd5c139fbe..33c1212c8793 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_vcenters.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_vcenters.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/ListVCenters.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/ListVCenters.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_vcenters_by_resource_group.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_vcenters_by_resource_group.py index af7610ff8cea..309ca58df2aa 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_vcenters_by_resource_group.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_vcenters_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/ListVCentersByResourceGroup.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/ListVCentersByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/guest_agent_list_by_vm.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machine_instances.py similarity index 77% rename from sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/guest_agent_list_by_vm.py rename to sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machine_instances.py index 29337051e12d..58c16455623e 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/guest_agent_list_by_vm.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machine_instances.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-connectedvmware # USAGE - python guest_agent_list_by_vm.py + python list_virtual_machine_instances.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, @@ -26,17 +26,16 @@ def main(): client = AzureArcVMwareManagementServiceAPI( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.guest_agents.list( - resource_group_name="testrg", - virtual_machine_name="ContosoVm", + response = client.virtual_machine_instances.list( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", ) for item in response: print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/GuestAgent_ListByVm.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/ListVirtualMachineInstances.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machine_templates.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machine_templates.py index eede81e5f7b6..c7c4cb71ded7 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machine_templates.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machine_templates.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/ListVirtualMachineTemplates.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/ListVirtualMachineTemplates.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machine_templates_by_resource_group.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machine_templates_by_resource_group.py index 4d16a053b14f..4341d20726c0 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machine_templates_by_resource_group.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machine_templates_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/ListVirtualMachineTemplatesByResourceGroup.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/ListVirtualMachineTemplatesByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machines.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machines.py deleted file mode 100644 index 2f8f452c9aca..000000000000 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machines.py +++ /dev/null @@ -1,39 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.connectedvmware import AzureArcVMwareManagementServiceAPI - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-connectedvmware -# USAGE - python list_virtual_machines.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 = AzureArcVMwareManagementServiceAPI( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.virtual_machines.list_all() - for item in response: - print(item) - - -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/ListVirtualMachines.json -if __name__ == "__main__": - main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machines_by_resource_group.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machines_by_resource_group.py deleted file mode 100644 index a3d548989c2c..000000000000 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_machines_by_resource_group.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.connectedvmware import AzureArcVMwareManagementServiceAPI - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-connectedvmware -# USAGE - python list_virtual_machines_by_resource_group.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 = AzureArcVMwareManagementServiceAPI( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.virtual_machines.list( - resource_group_name="testrg", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/ListVirtualMachinesByResourceGroup.json -if __name__ == "__main__": - main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_networks.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_networks.py index dec0c803b02f..bf173454338e 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_networks.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_networks.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/ListVirtualNetworks.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/ListVirtualNetworks.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_networks_by_resource_group.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_networks_by_resource_group.py index 990e80704282..04da4b750bd8 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_networks_by_resource_group.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/list_virtual_networks_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/ListVirtualNetworksByResourceGroup.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/ListVirtualNetworksByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/put_extension.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/put_extension.py deleted file mode 100644 index 8155107bb3cd..000000000000 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/put_extension.py +++ /dev/null @@ -1,51 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.connectedvmware import AzureArcVMwareManagementServiceAPI - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-connectedvmware -# USAGE - python put_extension.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 = AzureArcVMwareManagementServiceAPI( - credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", - ) - - response = client.machine_extensions.begin_create_or_update( - resource_group_name="myResourceGroup", - virtual_machine_name="myMachine", - extension_name="CustomScriptExtension", - extension_parameters={ - "location": "eastus2euap", - "properties": { - "publisher": "Microsoft.Compute", - "settings": {"commandToExecute": 'powershell.exe -c "Get-Process | Where-Object { $_.CPU -gt 10000 }"'}, - "type": "CustomScriptExtension", - "typeHandlerVersion": "1.10", - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/PUTExtension.json -if __name__ == "__main__": - main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/restart_virtual_machine.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/restart_virtual_machine.py deleted file mode 100644 index 09782dd86ce5..000000000000 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/restart_virtual_machine.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.connectedvmware import AzureArcVMwareManagementServiceAPI - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-connectedvmware -# USAGE - python restart_virtual_machine.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 = AzureArcVMwareManagementServiceAPI( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.virtual_machines.begin_restart( - resource_group_name="testrg", - virtual_machine_name="DemoVM", - ).result() - print(response) - - -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/RestartVirtualMachine.json -if __name__ == "__main__": - main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/restart_virtual_machine_instance.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/restart_virtual_machine_instance.py new file mode 100644 index 000000000000..da042fa2ea59 --- /dev/null +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/restart_virtual_machine_instance.py @@ -0,0 +1,39 @@ +# 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.connectedvmware import AzureArcVMwareManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-connectedvmware +# USAGE + python restart_virtual_machine_instance.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 = AzureArcVMwareManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.virtual_machine_instances.begin_restart( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + ).result() + + +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/RestartVirtualMachineInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/start_virtual_machine.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/start_virtual_machine.py deleted file mode 100644 index b73beb930dc0..000000000000 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/start_virtual_machine.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.connectedvmware import AzureArcVMwareManagementServiceAPI - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-connectedvmware -# USAGE - python start_virtual_machine.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 = AzureArcVMwareManagementServiceAPI( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.virtual_machines.begin_start( - resource_group_name="testrg", - virtual_machine_name="DemoVM", - ).result() - print(response) - - -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/StartVirtualMachine.json -if __name__ == "__main__": - main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_guest_agent.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/start_virtual_machine_instance.py similarity index 77% rename from sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_guest_agent.py rename to sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/start_virtual_machine_instance.py index 8261ca2fcb8a..0c5959f6b7c2 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_guest_agent.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/start_virtual_machine_instance.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-connectedvmware # USAGE - python delete_guest_agent.py + python start_virtual_machine_instance.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, @@ -26,17 +26,14 @@ def main(): client = AzureArcVMwareManagementServiceAPI( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.guest_agents.begin_delete( - resource_group_name="testrg", - virtual_machine_name="ContosoVm", - name="default", + client.virtual_machine_instances.begin_start( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", ).result() - print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/DeleteGuestAgent.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/StartVirtualMachineInstance.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/stop_virtual_machine.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/stop_virtual_machine.py deleted file mode 100644 index 0b731b5561a2..000000000000 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/stop_virtual_machine.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.connectedvmware import AzureArcVMwareManagementServiceAPI - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-connectedvmware -# USAGE - python stop_virtual_machine.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 = AzureArcVMwareManagementServiceAPI( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.virtual_machines.begin_stop( - resource_group_name="testrg", - virtual_machine_name="DemoVM", - ).result() - print(response) - - -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/StopVirtualMachine.json -if __name__ == "__main__": - main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_extension.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/stop_virtual_machine_instance.py similarity index 77% rename from sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_extension.py rename to sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/stop_virtual_machine_instance.py index 3142649176c1..17a84aa6c3c6 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/delete_extension.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/stop_virtual_machine_instance.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-connectedvmware # USAGE - python delete_extension.py + python stop_virtual_machine_instance.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, @@ -26,17 +26,14 @@ def main(): client = AzureArcVMwareManagementServiceAPI( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="SUBSCRIPTION_ID", ) - response = client.machine_extensions.begin_delete( - resource_group_name="myResourceGroup", - virtual_machine_name="myMachine", - extension_name="MMA", + client.virtual_machine_instances.begin_stop( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", ).result() - print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/DELETEExtension.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/StopVirtualMachineInstance.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_cluster.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_cluster.py index e30ba3e60a0c..b2462912ce96 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_cluster.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_cluster.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/UpdateCluster.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/UpdateCluster.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_datastore.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_datastore.py index a444ab7924ff..71dcea1d6c8e 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_datastore.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_datastore.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/UpdateDatastore.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/UpdateDatastore.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_extension.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_extension.py deleted file mode 100644 index 42d975fafbe8..000000000000 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_extension.py +++ /dev/null @@ -1,50 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.connectedvmware import AzureArcVMwareManagementServiceAPI - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-connectedvmware -# USAGE - python update_extension.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 = AzureArcVMwareManagementServiceAPI( - credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", - ) - - response = client.machine_extensions.begin_update( - resource_group_name="myResourceGroup", - virtual_machine_name="myMachine", - extension_name="CustomScriptExtension", - extension_parameters={ - "properties": { - "publisher": "Microsoft.Compute", - "settings": {"commandToExecute": 'powershell.exe -c "Get-Process | Where-Object { $_.CPU -lt 100 }"'}, - "type": "CustomScriptExtension", - "typeHandlerVersion": "1.10", - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/UpdateExtension.json -if __name__ == "__main__": - main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_host.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_host.py index 0cad59443d4f..6afc40f0dc2f 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_host.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_host.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/UpdateHost.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/UpdateHost.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_resource_pool.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_resource_pool.py index eb4688b60e9f..611ef23c65f0 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_resource_pool.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_resource_pool.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/UpdateResourcePool.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/UpdateResourcePool.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_vcenter.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_vcenter.py index 6c23bacb2822..4398e25e1294 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_vcenter.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_vcenter.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/UpdateVCenter.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/UpdateVCenter.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_virtual_machine.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_virtual_machine.py deleted file mode 100644 index 91ef376feb7e..000000000000 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_virtual_machine.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.connectedvmware import AzureArcVMwareManagementServiceAPI - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-connectedvmware -# USAGE - python update_virtual_machine.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 = AzureArcVMwareManagementServiceAPI( - credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", - ) - - response = client.virtual_machines.begin_update( - resource_group_name="testrg", - virtual_machine_name="DemoVM", - ).result() - print(response) - - -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/UpdateVirtualMachine.json -if __name__ == "__main__": - main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_virtual_machine_instance.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_virtual_machine_instance.py new file mode 100644 index 000000000000..31fa9ead54f7 --- /dev/null +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_virtual_machine_instance.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.connectedvmware import AzureArcVMwareManagementServiceAPI + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-connectedvmware +# USAGE + python update_virtual_machine_instance.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 = AzureArcVMwareManagementServiceAPI( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.virtual_machine_instances.begin_update( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + ).result() + print(response) + + +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/UpdateVirtualMachineInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_virtual_machine_template.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_virtual_machine_template.py index 40dc8889dd63..345839e511dd 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_virtual_machine_template.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_virtual_machine_template.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/UpdateVirtualMachineTemplate.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/UpdateVirtualMachineTemplate.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_virtual_network.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_virtual_network.py index 7cf06cb2373a..674d1d58077c 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_virtual_network.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/update_virtual_network.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/UpdateVirtualNetwork.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/UpdateVirtualNetwork.json if __name__ == "__main__": main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/virtual_machine_assess_patches.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/virtual_machine_assess_patches.py deleted file mode 100644 index aedc90c57f78..000000000000 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/virtual_machine_assess_patches.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.connectedvmware import AzureArcVMwareManagementServiceAPI - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-connectedvmware -# USAGE - python virtual_machine_assess_patches.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 = AzureArcVMwareManagementServiceAPI( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_assess_patches( - resource_group_name="myResourceGroupName", - virtual_machine_name="myMachineName", - ).result() - print(response) - - -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/VirtualMachineAssessPatches.json -if __name__ == "__main__": - main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/virtual_machine_install_patches.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/virtual_machine_install_patches.py deleted file mode 100644 index 5eab4379e4a4..000000000000 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/virtual_machine_install_patches.py +++ /dev/null @@ -1,49 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential -from azure.mgmt.connectedvmware import AzureArcVMwareManagementServiceAPI - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-connectedvmware -# USAGE - python virtual_machine_install_patches.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 = AzureArcVMwareManagementServiceAPI( - credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", - ) - - response = client.virtual_machines.begin_install_patches( - resource_group_name="myResourceGroupName", - virtual_machine_name="myMachineName", - install_patches_input={ - "maximumDuration": "PT3H", - "rebootSetting": "IfRequired", - "windowsParameters": { - "classificationsToInclude": ["Critical", "Security"], - "maxPatchPublishDate": "2022-01-15T02:36:43.0539904+00:00", - }, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/VirtualMachineInstallPatches.json -if __name__ == "__main__": - main() diff --git a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/hybrid_identity_metadata_list_by_vm.py b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/vm_instance_guest_agent_list_by_vm.py similarity index 77% rename from sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/hybrid_identity_metadata_list_by_vm.py rename to sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/vm_instance_guest_agent_list_by_vm.py index 8d17dc802263..8299f512d12a 100644 --- a/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/hybrid_identity_metadata_list_by_vm.py +++ b/sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/vm_instance_guest_agent_list_by_vm.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-connectedvmware # USAGE - python hybrid_identity_metadata_list_by_vm.py + python vm_instance_guest_agent_list_by_vm.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, @@ -26,17 +26,16 @@ def main(): client = AzureArcVMwareManagementServiceAPI( credential=DefaultAzureCredential(), - subscription_id="fd3c3665-1729-4b7b-9a38-238e83b0f98b", + subscription_id="SUBSCRIPTION_ID", ) - response = client.hybrid_identity_metadata.list( - resource_group_name="testrg", - virtual_machine_name="ContosoVm", + response = client.vm_instance_guest_agents.list( + resource_uri="subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", ) for item in response: print(item) -# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/preview/2022-07-15-preview/examples/HybridIdentityMetadata_ListByVm.json +# x-ms-original-file: specification/connectedvmware/resource-manager/Microsoft.ConnectedVMwarevSphere/stable/2023-10-01/examples/VMInstanceGuestAgent_ListByVm.json if __name__ == "__main__": main()