From 189df87eb7c142eb102e728050dc1d1deb4427c0 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 12 Apr 2021 22:01:01 +0000 Subject: [PATCH] CodeGen from PR 13220 in Azure/azure-rest-api-specs Merge 98dcd11cc7bbc30103d25ea3e3683d8dfe425690 into 872b7da6fe27183d4e0150f5c07055a21a6e4f27 --- sdk/compute/azure-mgmt-compute/_meta.json | 2 +- .../compute/_compute_management_client.py | 88 +- .../compute/aio/_compute_management_client.py | 88 +- .../v2021_03_01/_compute_management_client.py | 110 + .../mgmt/compute/v2021_03_01/_metadata.json | 24 +- .../aio/_compute_management_client.py | 110 + .../v2021_03_01/aio/operations/__init__.py | 44 + .../_availability_sets_operations.py | 502 + ...cloud_service_role_instances_operations.py | 8 +- .../_dedicated_host_groups_operations.py | 435 + .../operations/_dedicated_hosts_operations.py | 565 + .../aio/operations/_images_operations.py | 606 + .../operations/_log_analytics_operations.py | 283 + .../v2021_03_01/aio/operations/_operations.py | 104 + .../_proximity_placement_groups_operations.py | 431 + .../operations/_ssh_public_keys_operations.py | 487 + .../aio/operations/_usage_operations.py | 113 + ...ual_machine_extension_images_operations.py | 242 + .../_virtual_machine_extensions_operations.py | 555 + ...ual_machine_images_edge_zone_operations.py | 390 + .../_virtual_machine_images_operations.py | 367 + ...virtual_machine_run_commands_operations.py | 700 + ...machine_scale_set_extensions_operations.py | 571 + ...e_scale_set_rolling_upgrades_operations.py | 423 + ...hine_scale_set_vm_extensions_operations.py | 585 + ...ne_scale_set_vm_run_commands_operations.py | 600 + ...irtual_machine_scale_set_vms_operations.py | 1714 +++ .../_virtual_machine_scale_sets_operations.py | 2340 ++++ .../_virtual_machine_sizes_operations.py | 113 + .../_virtual_machines_operations.py | 2473 ++++ .../compute/v2021_03_01/models/__init__.py | 699 + .../_compute_management_client_enums.py | 610 + .../compute/v2021_03_01/models/_models.py | 9863 ++++++++++++- .../compute/v2021_03_01/models/_models_py3.py | 11390 ++++++++++++++-- .../v2021_03_01/operations/__init__.py | 44 + .../_availability_sets_operations.py | 513 + ...cloud_service_role_instances_operations.py | 8 +- .../_dedicated_host_groups_operations.py | 445 + .../operations/_dedicated_hosts_operations.py | 577 + .../operations/_images_operations.py | 619 + .../operations/_log_analytics_operations.py | 291 + .../v2021_03_01/operations/_operations.py | 109 + .../_proximity_placement_groups_operations.py | 441 + .../operations/_ssh_public_keys_operations.py | 498 + .../operations/_usage_operations.py | 118 + ...ual_machine_extension_images_operations.py | 249 + .../_virtual_machine_extensions_operations.py | 567 + ...ual_machine_images_edge_zone_operations.py | 399 + .../_virtual_machine_images_operations.py | 376 + ...virtual_machine_run_commands_operations.py | 714 + ...machine_scale_set_extensions_operations.py | 583 + ...e_scale_set_rolling_upgrades_operations.py | 434 + ...hine_scale_set_vm_extensions_operations.py | 597 + ...ne_scale_set_vm_run_commands_operations.py | 612 + ...irtual_machine_scale_set_vms_operations.py | 1745 +++ .../_virtual_machine_scale_sets_operations.py | 2381 ++++ .../_virtual_machine_sizes_operations.py | 118 + .../_virtual_machines_operations.py | 2518 ++++ 58 files changed, 51150 insertions(+), 1441 deletions(-) create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_availability_sets_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_dedicated_host_groups_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_dedicated_hosts_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_images_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_log_analytics_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_proximity_placement_groups_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_ssh_public_keys_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_usage_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_extension_images_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_extensions_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_images_edge_zone_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_images_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_run_commands_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_vms_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_sets_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_sizes_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machines_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_availability_sets_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_dedicated_host_groups_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_dedicated_hosts_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_images_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_log_analytics_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_proximity_placement_groups_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_ssh_public_keys_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_usage_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_extension_images_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_extensions_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_images_edge_zone_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_images_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_run_commands_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_extensions_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_vms_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_sets_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_sizes_operations.py create mode 100644 sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machines_operations.py diff --git a/sdk/compute/azure-mgmt-compute/_meta.json b/sdk/compute/azure-mgmt-compute/_meta.json index 85b6a0aa20253..b7f728fd558a8 100644 --- a/sdk/compute/azure-mgmt-compute/_meta.json +++ b/sdk/compute/azure-mgmt-compute/_meta.json @@ -1,7 +1,7 @@ { "autorest": "3.0.6369", "use": "@autorest/python@5.6.2", - "commit": "b79c669038a6932848bf402578a4bceb2e9f329c", + "commit": "b9d6add057b5fceac2471438cd619167bb005641", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest_command": "autorest specification/compute/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.6.2 --version=3.0.6369", "readme": "specification/compute/resource-manager/readme.md" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_compute_management_client.py index 5f35866b10658..7a2fb21fe2ed7 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/_compute_management_client.py @@ -60,9 +60,6 @@ class ComputeManagementClient(MultiApiClientMixin, _SDKClient): LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { None: DEFAULT_API_VERSION, - 'availability_sets': '2020-12-01', - 'dedicated_host_groups': '2020-12-01', - 'dedicated_hosts': '2020-12-01', 'disk_accesses': '2020-12-01', 'disk_encryption_sets': '2020-12-01', 'disk_restore_point': '2020-12-01', @@ -73,30 +70,11 @@ class ComputeManagementClient(MultiApiClientMixin, _SDKClient): 'gallery_image_versions': '2020-09-30', 'gallery_images': '2020-09-30', 'gallery_sharing_profile': '2020-09-30', - 'images': '2020-12-01', - 'log_analytics': '2020-12-01', - 'operations': '2020-12-01', - 'proximity_placement_groups': '2020-12-01', 'resource_skus': '2019-04-01', 'shared_galleries': '2020-09-30', 'shared_gallery_image_versions': '2020-09-30', 'shared_gallery_images': '2020-09-30', 'snapshots': '2020-12-01', - 'ssh_public_keys': '2020-12-01', - 'usage': '2020-12-01', - 'virtual_machine_extension_images': '2020-12-01', - 'virtual_machine_extensions': '2020-12-01', - 'virtual_machine_images': '2020-12-01', - 'virtual_machine_images_edge_zone': '2020-12-01', - 'virtual_machine_run_commands': '2020-12-01', - 'virtual_machine_scale_set_extensions': '2020-12-01', - 'virtual_machine_scale_set_rolling_upgrades': '2020-12-01', - 'virtual_machine_scale_set_vm_extensions': '2020-12-01', - 'virtual_machine_scale_set_vm_run_commands': '2020-12-01', - 'virtual_machine_scale_set_vms': '2020-12-01', - 'virtual_machine_scale_sets': '2020-12-01', - 'virtual_machine_sizes': '2020-12-01', - 'virtual_machines': '2020-12-01', }}, _PROFILE_TAG + " latest" ) @@ -235,6 +213,7 @@ def availability_sets(self): * 2019-12-01: :class:`AvailabilitySetsOperations` * 2020-06-01: :class:`AvailabilitySetsOperations` * 2020-12-01: :class:`AvailabilitySetsOperations` + * 2021-03-01: :class:`AvailabilitySetsOperations` """ api_version = self._get_api_version('availability_sets') if api_version == '2015-06-15': @@ -263,6 +242,8 @@ def availability_sets(self): from .v2020_06_01.operations import AvailabilitySetsOperations as OperationClass elif api_version == '2020-12-01': from .v2020_12_01.operations import AvailabilitySetsOperations as OperationClass + elif api_version == '2021-03-01': + from .v2021_03_01.operations import AvailabilitySetsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'availability_sets'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -353,6 +334,7 @@ def dedicated_host_groups(self): * 2019-12-01: :class:`DedicatedHostGroupsOperations` * 2020-06-01: :class:`DedicatedHostGroupsOperations` * 2020-12-01: :class:`DedicatedHostGroupsOperations` + * 2021-03-01: :class:`DedicatedHostGroupsOperations` """ api_version = self._get_api_version('dedicated_host_groups') if api_version == '2019-03-01': @@ -365,6 +347,8 @@ def dedicated_host_groups(self): from .v2020_06_01.operations import DedicatedHostGroupsOperations as OperationClass elif api_version == '2020-12-01': from .v2020_12_01.operations import DedicatedHostGroupsOperations as OperationClass + elif api_version == '2021-03-01': + from .v2021_03_01.operations import DedicatedHostGroupsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'dedicated_host_groups'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -378,6 +362,7 @@ def dedicated_hosts(self): * 2019-12-01: :class:`DedicatedHostsOperations` * 2020-06-01: :class:`DedicatedHostsOperations` * 2020-12-01: :class:`DedicatedHostsOperations` + * 2021-03-01: :class:`DedicatedHostsOperations` """ api_version = self._get_api_version('dedicated_hosts') if api_version == '2019-03-01': @@ -390,6 +375,8 @@ def dedicated_hosts(self): from .v2020_06_01.operations import DedicatedHostsOperations as OperationClass elif api_version == '2020-12-01': from .v2020_12_01.operations import DedicatedHostsOperations as OperationClass + elif api_version == '2021-03-01': + from .v2021_03_01.operations import DedicatedHostsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'dedicated_hosts'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -653,6 +640,7 @@ def images(self): * 2019-12-01: :class:`ImagesOperations` * 2020-06-01: :class:`ImagesOperations` * 2020-12-01: :class:`ImagesOperations` + * 2021-03-01: :class:`ImagesOperations` """ api_version = self._get_api_version('images') if api_version == '2016-04-30-preview': @@ -677,6 +665,8 @@ def images(self): from .v2020_06_01.operations import ImagesOperations as OperationClass elif api_version == '2020-12-01': from .v2020_12_01.operations import ImagesOperations as OperationClass + elif api_version == '2021-03-01': + from .v2021_03_01.operations import ImagesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'images'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -694,6 +684,7 @@ def log_analytics(self): * 2019-12-01: :class:`LogAnalyticsOperations` * 2020-06-01: :class:`LogAnalyticsOperations` * 2020-12-01: :class:`LogAnalyticsOperations` + * 2021-03-01: :class:`LogAnalyticsOperations` """ api_version = self._get_api_version('log_analytics') if api_version == '2017-12-01': @@ -714,6 +705,8 @@ def log_analytics(self): from .v2020_06_01.operations import LogAnalyticsOperations as OperationClass elif api_version == '2020-12-01': from .v2020_12_01.operations import LogAnalyticsOperations as OperationClass + elif api_version == '2021-03-01': + from .v2021_03_01.operations import LogAnalyticsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'log_analytics'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -731,6 +724,7 @@ def operations(self): * 2019-12-01: :class:`Operations` * 2020-06-01: :class:`Operations` * 2020-12-01: :class:`Operations` + * 2021-03-01: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2017-12-01': @@ -751,6 +745,8 @@ def operations(self): from .v2020_06_01.operations import Operations as OperationClass elif api_version == '2020-12-01': from .v2020_12_01.operations import Operations as OperationClass + elif api_version == '2021-03-01': + from .v2021_03_01.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -767,6 +763,7 @@ def proximity_placement_groups(self): * 2019-12-01: :class:`ProximityPlacementGroupsOperations` * 2020-06-01: :class:`ProximityPlacementGroupsOperations` * 2020-12-01: :class:`ProximityPlacementGroupsOperations` + * 2021-03-01: :class:`ProximityPlacementGroupsOperations` """ api_version = self._get_api_version('proximity_placement_groups') if api_version == '2018-04-01': @@ -785,6 +782,8 @@ def proximity_placement_groups(self): from .v2020_06_01.operations import ProximityPlacementGroupsOperations as OperationClass elif api_version == '2020-12-01': from .v2020_12_01.operations import ProximityPlacementGroupsOperations as OperationClass + elif api_version == '2021-03-01': + from .v2021_03_01.operations import ProximityPlacementGroupsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'proximity_placement_groups'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -900,6 +899,7 @@ def ssh_public_keys(self): * 2019-12-01: :class:`SshPublicKeysOperations` * 2020-06-01: :class:`SshPublicKeysOperations` * 2020-12-01: :class:`SshPublicKeysOperations` + * 2021-03-01: :class:`SshPublicKeysOperations` """ api_version = self._get_api_version('ssh_public_keys') if api_version == '2019-12-01': @@ -908,6 +908,8 @@ def ssh_public_keys(self): from .v2020_06_01.operations import SshPublicKeysOperations as OperationClass elif api_version == '2020-12-01': from .v2020_12_01.operations import SshPublicKeysOperations as OperationClass + elif api_version == '2021-03-01': + from .v2021_03_01.operations import SshPublicKeysOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'ssh_public_keys'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -929,6 +931,7 @@ def usage(self): * 2019-12-01: :class:`UsageOperations` * 2020-06-01: :class:`UsageOperations` * 2020-12-01: :class:`UsageOperations` + * 2021-03-01: :class:`UsageOperations` """ api_version = self._get_api_version('usage') if api_version == '2015-06-15': @@ -957,6 +960,8 @@ def usage(self): from .v2020_06_01.operations import UsageOperations as OperationClass elif api_version == '2020-12-01': from .v2020_12_01.operations import UsageOperations as OperationClass + elif api_version == '2021-03-01': + from .v2021_03_01.operations import UsageOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'usage'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -978,6 +983,7 @@ def virtual_machine_extension_images(self): * 2019-12-01: :class:`VirtualMachineExtensionImagesOperations` * 2020-06-01: :class:`VirtualMachineExtensionImagesOperations` * 2020-12-01: :class:`VirtualMachineExtensionImagesOperations` + * 2021-03-01: :class:`VirtualMachineExtensionImagesOperations` """ api_version = self._get_api_version('virtual_machine_extension_images') if api_version == '2015-06-15': @@ -1006,6 +1012,8 @@ def virtual_machine_extension_images(self): from .v2020_06_01.operations import VirtualMachineExtensionImagesOperations as OperationClass elif api_version == '2020-12-01': from .v2020_12_01.operations import VirtualMachineExtensionImagesOperations as OperationClass + elif api_version == '2021-03-01': + from .v2021_03_01.operations import VirtualMachineExtensionImagesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_extension_images'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1027,6 +1035,7 @@ def virtual_machine_extensions(self): * 2019-12-01: :class:`VirtualMachineExtensionsOperations` * 2020-06-01: :class:`VirtualMachineExtensionsOperations` * 2020-12-01: :class:`VirtualMachineExtensionsOperations` + * 2021-03-01: :class:`VirtualMachineExtensionsOperations` """ api_version = self._get_api_version('virtual_machine_extensions') if api_version == '2015-06-15': @@ -1055,6 +1064,8 @@ def virtual_machine_extensions(self): from .v2020_06_01.operations import VirtualMachineExtensionsOperations as OperationClass elif api_version == '2020-12-01': from .v2020_12_01.operations import VirtualMachineExtensionsOperations as OperationClass + elif api_version == '2021-03-01': + from .v2021_03_01.operations import VirtualMachineExtensionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_extensions'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1076,6 +1087,7 @@ def virtual_machine_images(self): * 2019-12-01: :class:`VirtualMachineImagesOperations` * 2020-06-01: :class:`VirtualMachineImagesOperations` * 2020-12-01: :class:`VirtualMachineImagesOperations` + * 2021-03-01: :class:`VirtualMachineImagesOperations` """ api_version = self._get_api_version('virtual_machine_images') if api_version == '2015-06-15': @@ -1104,6 +1116,8 @@ def virtual_machine_images(self): from .v2020_06_01.operations import VirtualMachineImagesOperations as OperationClass elif api_version == '2020-12-01': from .v2020_12_01.operations import VirtualMachineImagesOperations as OperationClass + elif api_version == '2021-03-01': + from .v2021_03_01.operations import VirtualMachineImagesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_images'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1113,10 +1127,13 @@ def virtual_machine_images_edge_zone(self): """Instance depends on the API version: * 2020-12-01: :class:`VirtualMachineImagesEdgeZoneOperations` + * 2021-03-01: :class:`VirtualMachineImagesEdgeZoneOperations` """ api_version = self._get_api_version('virtual_machine_images_edge_zone') if api_version == '2020-12-01': from .v2020_12_01.operations import VirtualMachineImagesEdgeZoneOperations as OperationClass + elif api_version == '2021-03-01': + from .v2021_03_01.operations import VirtualMachineImagesEdgeZoneOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_images_edge_zone'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1135,6 +1152,7 @@ def virtual_machine_run_commands(self): * 2019-12-01: :class:`VirtualMachineRunCommandsOperations` * 2020-06-01: :class:`VirtualMachineRunCommandsOperations` * 2020-12-01: :class:`VirtualMachineRunCommandsOperations` + * 2021-03-01: :class:`VirtualMachineRunCommandsOperations` """ api_version = self._get_api_version('virtual_machine_run_commands') if api_version == '2017-03-30': @@ -1157,6 +1175,8 @@ def virtual_machine_run_commands(self): from .v2020_06_01.operations import VirtualMachineRunCommandsOperations as OperationClass elif api_version == '2020-12-01': from .v2020_12_01.operations import VirtualMachineRunCommandsOperations as OperationClass + elif api_version == '2021-03-01': + from .v2021_03_01.operations import VirtualMachineRunCommandsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_run_commands'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1175,6 +1195,7 @@ def virtual_machine_scale_set_extensions(self): * 2019-12-01: :class:`VirtualMachineScaleSetExtensionsOperations` * 2020-06-01: :class:`VirtualMachineScaleSetExtensionsOperations` * 2020-12-01: :class:`VirtualMachineScaleSetExtensionsOperations` + * 2021-03-01: :class:`VirtualMachineScaleSetExtensionsOperations` """ api_version = self._get_api_version('virtual_machine_scale_set_extensions') if api_version == '2017-03-30': @@ -1197,6 +1218,8 @@ def virtual_machine_scale_set_extensions(self): from .v2020_06_01.operations import VirtualMachineScaleSetExtensionsOperations as OperationClass elif api_version == '2020-12-01': from .v2020_12_01.operations import VirtualMachineScaleSetExtensionsOperations as OperationClass + elif api_version == '2021-03-01': + from .v2021_03_01.operations import VirtualMachineScaleSetExtensionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_scale_set_extensions'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1215,6 +1238,7 @@ def virtual_machine_scale_set_rolling_upgrades(self): * 2019-12-01: :class:`VirtualMachineScaleSetRollingUpgradesOperations` * 2020-06-01: :class:`VirtualMachineScaleSetRollingUpgradesOperations` * 2020-12-01: :class:`VirtualMachineScaleSetRollingUpgradesOperations` + * 2021-03-01: :class:`VirtualMachineScaleSetRollingUpgradesOperations` """ api_version = self._get_api_version('virtual_machine_scale_set_rolling_upgrades') if api_version == '2017-03-30': @@ -1237,6 +1261,8 @@ def virtual_machine_scale_set_rolling_upgrades(self): from .v2020_06_01.operations import VirtualMachineScaleSetRollingUpgradesOperations as OperationClass elif api_version == '2020-12-01': from .v2020_12_01.operations import VirtualMachineScaleSetRollingUpgradesOperations as OperationClass + elif api_version == '2021-03-01': + from .v2021_03_01.operations import VirtualMachineScaleSetRollingUpgradesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_scale_set_rolling_upgrades'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1249,6 +1275,7 @@ def virtual_machine_scale_set_vm_extensions(self): * 2019-12-01: :class:`VirtualMachineScaleSetVMExtensionsOperations` * 2020-06-01: :class:`VirtualMachineScaleSetVMExtensionsOperations` * 2020-12-01: :class:`VirtualMachineScaleSetVMExtensionsOperations` + * 2021-03-01: :class:`VirtualMachineScaleSetVMExtensionsOperations` """ api_version = self._get_api_version('virtual_machine_scale_set_vm_extensions') if api_version == '2019-07-01': @@ -1259,6 +1286,8 @@ def virtual_machine_scale_set_vm_extensions(self): from .v2020_06_01.operations import VirtualMachineScaleSetVMExtensionsOperations as OperationClass elif api_version == '2020-12-01': from .v2020_12_01.operations import VirtualMachineScaleSetVMExtensionsOperations as OperationClass + elif api_version == '2021-03-01': + from .v2021_03_01.operations import VirtualMachineScaleSetVMExtensionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_scale_set_vm_extensions'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1269,12 +1298,15 @@ def virtual_machine_scale_set_vm_run_commands(self): * 2020-06-01: :class:`VirtualMachineScaleSetVMRunCommandsOperations` * 2020-12-01: :class:`VirtualMachineScaleSetVMRunCommandsOperations` + * 2021-03-01: :class:`VirtualMachineScaleSetVMRunCommandsOperations` """ api_version = self._get_api_version('virtual_machine_scale_set_vm_run_commands') if api_version == '2020-06-01': from .v2020_06_01.operations import VirtualMachineScaleSetVMRunCommandsOperations as OperationClass elif api_version == '2020-12-01': from .v2020_12_01.operations import VirtualMachineScaleSetVMRunCommandsOperations as OperationClass + elif api_version == '2021-03-01': + from .v2021_03_01.operations import VirtualMachineScaleSetVMRunCommandsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_scale_set_vm_run_commands'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1296,6 +1328,7 @@ def virtual_machine_scale_set_vms(self): * 2019-12-01: :class:`VirtualMachineScaleSetVMsOperations` * 2020-06-01: :class:`VirtualMachineScaleSetVMsOperations` * 2020-12-01: :class:`VirtualMachineScaleSetVMsOperations` + * 2021-03-01: :class:`VirtualMachineScaleSetVMsOperations` """ api_version = self._get_api_version('virtual_machine_scale_set_vms') if api_version == '2015-06-15': @@ -1324,6 +1357,8 @@ def virtual_machine_scale_set_vms(self): from .v2020_06_01.operations import VirtualMachineScaleSetVMsOperations as OperationClass elif api_version == '2020-12-01': from .v2020_12_01.operations import VirtualMachineScaleSetVMsOperations as OperationClass + elif api_version == '2021-03-01': + from .v2021_03_01.operations import VirtualMachineScaleSetVMsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_scale_set_vms'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1345,6 +1380,7 @@ def virtual_machine_scale_sets(self): * 2019-12-01: :class:`VirtualMachineScaleSetsOperations` * 2020-06-01: :class:`VirtualMachineScaleSetsOperations` * 2020-12-01: :class:`VirtualMachineScaleSetsOperations` + * 2021-03-01: :class:`VirtualMachineScaleSetsOperations` """ api_version = self._get_api_version('virtual_machine_scale_sets') if api_version == '2015-06-15': @@ -1373,6 +1409,8 @@ def virtual_machine_scale_sets(self): from .v2020_06_01.operations import VirtualMachineScaleSetsOperations as OperationClass elif api_version == '2020-12-01': from .v2020_12_01.operations import VirtualMachineScaleSetsOperations as OperationClass + elif api_version == '2021-03-01': + from .v2021_03_01.operations import VirtualMachineScaleSetsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_scale_sets'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1394,6 +1432,7 @@ def virtual_machine_sizes(self): * 2019-12-01: :class:`VirtualMachineSizesOperations` * 2020-06-01: :class:`VirtualMachineSizesOperations` * 2020-12-01: :class:`VirtualMachineSizesOperations` + * 2021-03-01: :class:`VirtualMachineSizesOperations` """ api_version = self._get_api_version('virtual_machine_sizes') if api_version == '2015-06-15': @@ -1422,6 +1461,8 @@ def virtual_machine_sizes(self): from .v2020_06_01.operations import VirtualMachineSizesOperations as OperationClass elif api_version == '2020-12-01': from .v2020_12_01.operations import VirtualMachineSizesOperations as OperationClass + elif api_version == '2021-03-01': + from .v2021_03_01.operations import VirtualMachineSizesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_sizes'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1443,6 +1484,7 @@ def virtual_machines(self): * 2019-12-01: :class:`VirtualMachinesOperations` * 2020-06-01: :class:`VirtualMachinesOperations` * 2020-12-01: :class:`VirtualMachinesOperations` + * 2021-03-01: :class:`VirtualMachinesOperations` """ api_version = self._get_api_version('virtual_machines') if api_version == '2015-06-15': @@ -1471,6 +1513,8 @@ def virtual_machines(self): from .v2020_06_01.operations import VirtualMachinesOperations as OperationClass elif api_version == '2020-12-01': from .v2020_12_01.operations import VirtualMachinesOperations as OperationClass + elif api_version == '2021-03-01': + from .v2021_03_01.operations import VirtualMachinesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machines'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_compute_management_client.py index 9e5fe729b1683..8a49537dd3e45 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/aio/_compute_management_client.py @@ -58,9 +58,6 @@ class ComputeManagementClient(MultiApiClientMixin, _SDKClient): LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { None: DEFAULT_API_VERSION, - 'availability_sets': '2020-12-01', - 'dedicated_host_groups': '2020-12-01', - 'dedicated_hosts': '2020-12-01', 'disk_accesses': '2020-12-01', 'disk_encryption_sets': '2020-12-01', 'disk_restore_point': '2020-12-01', @@ -71,30 +68,11 @@ class ComputeManagementClient(MultiApiClientMixin, _SDKClient): 'gallery_image_versions': '2020-09-30', 'gallery_images': '2020-09-30', 'gallery_sharing_profile': '2020-09-30', - 'images': '2020-12-01', - 'log_analytics': '2020-12-01', - 'operations': '2020-12-01', - 'proximity_placement_groups': '2020-12-01', 'resource_skus': '2019-04-01', 'shared_galleries': '2020-09-30', 'shared_gallery_image_versions': '2020-09-30', 'shared_gallery_images': '2020-09-30', 'snapshots': '2020-12-01', - 'ssh_public_keys': '2020-12-01', - 'usage': '2020-12-01', - 'virtual_machine_extension_images': '2020-12-01', - 'virtual_machine_extensions': '2020-12-01', - 'virtual_machine_images': '2020-12-01', - 'virtual_machine_images_edge_zone': '2020-12-01', - 'virtual_machine_run_commands': '2020-12-01', - 'virtual_machine_scale_set_extensions': '2020-12-01', - 'virtual_machine_scale_set_rolling_upgrades': '2020-12-01', - 'virtual_machine_scale_set_vm_extensions': '2020-12-01', - 'virtual_machine_scale_set_vm_run_commands': '2020-12-01', - 'virtual_machine_scale_set_vms': '2020-12-01', - 'virtual_machine_scale_sets': '2020-12-01', - 'virtual_machine_sizes': '2020-12-01', - 'virtual_machines': '2020-12-01', }}, _PROFILE_TAG + " latest" ) @@ -233,6 +211,7 @@ def availability_sets(self): * 2019-12-01: :class:`AvailabilitySetsOperations` * 2020-06-01: :class:`AvailabilitySetsOperations` * 2020-12-01: :class:`AvailabilitySetsOperations` + * 2021-03-01: :class:`AvailabilitySetsOperations` """ api_version = self._get_api_version('availability_sets') if api_version == '2015-06-15': @@ -261,6 +240,8 @@ def availability_sets(self): from ..v2020_06_01.aio.operations import AvailabilitySetsOperations as OperationClass elif api_version == '2020-12-01': from ..v2020_12_01.aio.operations import AvailabilitySetsOperations as OperationClass + elif api_version == '2021-03-01': + from ..v2021_03_01.aio.operations import AvailabilitySetsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'availability_sets'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -351,6 +332,7 @@ def dedicated_host_groups(self): * 2019-12-01: :class:`DedicatedHostGroupsOperations` * 2020-06-01: :class:`DedicatedHostGroupsOperations` * 2020-12-01: :class:`DedicatedHostGroupsOperations` + * 2021-03-01: :class:`DedicatedHostGroupsOperations` """ api_version = self._get_api_version('dedicated_host_groups') if api_version == '2019-03-01': @@ -363,6 +345,8 @@ def dedicated_host_groups(self): from ..v2020_06_01.aio.operations import DedicatedHostGroupsOperations as OperationClass elif api_version == '2020-12-01': from ..v2020_12_01.aio.operations import DedicatedHostGroupsOperations as OperationClass + elif api_version == '2021-03-01': + from ..v2021_03_01.aio.operations import DedicatedHostGroupsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'dedicated_host_groups'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -376,6 +360,7 @@ def dedicated_hosts(self): * 2019-12-01: :class:`DedicatedHostsOperations` * 2020-06-01: :class:`DedicatedHostsOperations` * 2020-12-01: :class:`DedicatedHostsOperations` + * 2021-03-01: :class:`DedicatedHostsOperations` """ api_version = self._get_api_version('dedicated_hosts') if api_version == '2019-03-01': @@ -388,6 +373,8 @@ def dedicated_hosts(self): from ..v2020_06_01.aio.operations import DedicatedHostsOperations as OperationClass elif api_version == '2020-12-01': from ..v2020_12_01.aio.operations import DedicatedHostsOperations as OperationClass + elif api_version == '2021-03-01': + from ..v2021_03_01.aio.operations import DedicatedHostsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'dedicated_hosts'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -651,6 +638,7 @@ def images(self): * 2019-12-01: :class:`ImagesOperations` * 2020-06-01: :class:`ImagesOperations` * 2020-12-01: :class:`ImagesOperations` + * 2021-03-01: :class:`ImagesOperations` """ api_version = self._get_api_version('images') if api_version == '2016-04-30-preview': @@ -675,6 +663,8 @@ def images(self): from ..v2020_06_01.aio.operations import ImagesOperations as OperationClass elif api_version == '2020-12-01': from ..v2020_12_01.aio.operations import ImagesOperations as OperationClass + elif api_version == '2021-03-01': + from ..v2021_03_01.aio.operations import ImagesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'images'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -692,6 +682,7 @@ def log_analytics(self): * 2019-12-01: :class:`LogAnalyticsOperations` * 2020-06-01: :class:`LogAnalyticsOperations` * 2020-12-01: :class:`LogAnalyticsOperations` + * 2021-03-01: :class:`LogAnalyticsOperations` """ api_version = self._get_api_version('log_analytics') if api_version == '2017-12-01': @@ -712,6 +703,8 @@ def log_analytics(self): from ..v2020_06_01.aio.operations import LogAnalyticsOperations as OperationClass elif api_version == '2020-12-01': from ..v2020_12_01.aio.operations import LogAnalyticsOperations as OperationClass + elif api_version == '2021-03-01': + from ..v2021_03_01.aio.operations import LogAnalyticsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'log_analytics'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -729,6 +722,7 @@ def operations(self): * 2019-12-01: :class:`Operations` * 2020-06-01: :class:`Operations` * 2020-12-01: :class:`Operations` + * 2021-03-01: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2017-12-01': @@ -749,6 +743,8 @@ def operations(self): from ..v2020_06_01.aio.operations import Operations as OperationClass elif api_version == '2020-12-01': from ..v2020_12_01.aio.operations import Operations as OperationClass + elif api_version == '2021-03-01': + from ..v2021_03_01.aio.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -765,6 +761,7 @@ def proximity_placement_groups(self): * 2019-12-01: :class:`ProximityPlacementGroupsOperations` * 2020-06-01: :class:`ProximityPlacementGroupsOperations` * 2020-12-01: :class:`ProximityPlacementGroupsOperations` + * 2021-03-01: :class:`ProximityPlacementGroupsOperations` """ api_version = self._get_api_version('proximity_placement_groups') if api_version == '2018-04-01': @@ -783,6 +780,8 @@ def proximity_placement_groups(self): from ..v2020_06_01.aio.operations import ProximityPlacementGroupsOperations as OperationClass elif api_version == '2020-12-01': from ..v2020_12_01.aio.operations import ProximityPlacementGroupsOperations as OperationClass + elif api_version == '2021-03-01': + from ..v2021_03_01.aio.operations import ProximityPlacementGroupsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'proximity_placement_groups'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -898,6 +897,7 @@ def ssh_public_keys(self): * 2019-12-01: :class:`SshPublicKeysOperations` * 2020-06-01: :class:`SshPublicKeysOperations` * 2020-12-01: :class:`SshPublicKeysOperations` + * 2021-03-01: :class:`SshPublicKeysOperations` """ api_version = self._get_api_version('ssh_public_keys') if api_version == '2019-12-01': @@ -906,6 +906,8 @@ def ssh_public_keys(self): from ..v2020_06_01.aio.operations import SshPublicKeysOperations as OperationClass elif api_version == '2020-12-01': from ..v2020_12_01.aio.operations import SshPublicKeysOperations as OperationClass + elif api_version == '2021-03-01': + from ..v2021_03_01.aio.operations import SshPublicKeysOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'ssh_public_keys'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -927,6 +929,7 @@ def usage(self): * 2019-12-01: :class:`UsageOperations` * 2020-06-01: :class:`UsageOperations` * 2020-12-01: :class:`UsageOperations` + * 2021-03-01: :class:`UsageOperations` """ api_version = self._get_api_version('usage') if api_version == '2015-06-15': @@ -955,6 +958,8 @@ def usage(self): from ..v2020_06_01.aio.operations import UsageOperations as OperationClass elif api_version == '2020-12-01': from ..v2020_12_01.aio.operations import UsageOperations as OperationClass + elif api_version == '2021-03-01': + from ..v2021_03_01.aio.operations import UsageOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'usage'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -976,6 +981,7 @@ def virtual_machine_extension_images(self): * 2019-12-01: :class:`VirtualMachineExtensionImagesOperations` * 2020-06-01: :class:`VirtualMachineExtensionImagesOperations` * 2020-12-01: :class:`VirtualMachineExtensionImagesOperations` + * 2021-03-01: :class:`VirtualMachineExtensionImagesOperations` """ api_version = self._get_api_version('virtual_machine_extension_images') if api_version == '2015-06-15': @@ -1004,6 +1010,8 @@ def virtual_machine_extension_images(self): from ..v2020_06_01.aio.operations import VirtualMachineExtensionImagesOperations as OperationClass elif api_version == '2020-12-01': from ..v2020_12_01.aio.operations import VirtualMachineExtensionImagesOperations as OperationClass + elif api_version == '2021-03-01': + from ..v2021_03_01.aio.operations import VirtualMachineExtensionImagesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_extension_images'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1025,6 +1033,7 @@ def virtual_machine_extensions(self): * 2019-12-01: :class:`VirtualMachineExtensionsOperations` * 2020-06-01: :class:`VirtualMachineExtensionsOperations` * 2020-12-01: :class:`VirtualMachineExtensionsOperations` + * 2021-03-01: :class:`VirtualMachineExtensionsOperations` """ api_version = self._get_api_version('virtual_machine_extensions') if api_version == '2015-06-15': @@ -1053,6 +1062,8 @@ def virtual_machine_extensions(self): from ..v2020_06_01.aio.operations import VirtualMachineExtensionsOperations as OperationClass elif api_version == '2020-12-01': from ..v2020_12_01.aio.operations import VirtualMachineExtensionsOperations as OperationClass + elif api_version == '2021-03-01': + from ..v2021_03_01.aio.operations import VirtualMachineExtensionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_extensions'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1074,6 +1085,7 @@ def virtual_machine_images(self): * 2019-12-01: :class:`VirtualMachineImagesOperations` * 2020-06-01: :class:`VirtualMachineImagesOperations` * 2020-12-01: :class:`VirtualMachineImagesOperations` + * 2021-03-01: :class:`VirtualMachineImagesOperations` """ api_version = self._get_api_version('virtual_machine_images') if api_version == '2015-06-15': @@ -1102,6 +1114,8 @@ def virtual_machine_images(self): from ..v2020_06_01.aio.operations import VirtualMachineImagesOperations as OperationClass elif api_version == '2020-12-01': from ..v2020_12_01.aio.operations import VirtualMachineImagesOperations as OperationClass + elif api_version == '2021-03-01': + from ..v2021_03_01.aio.operations import VirtualMachineImagesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_images'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1111,10 +1125,13 @@ def virtual_machine_images_edge_zone(self): """Instance depends on the API version: * 2020-12-01: :class:`VirtualMachineImagesEdgeZoneOperations` + * 2021-03-01: :class:`VirtualMachineImagesEdgeZoneOperations` """ api_version = self._get_api_version('virtual_machine_images_edge_zone') if api_version == '2020-12-01': from ..v2020_12_01.aio.operations import VirtualMachineImagesEdgeZoneOperations as OperationClass + elif api_version == '2021-03-01': + from ..v2021_03_01.aio.operations import VirtualMachineImagesEdgeZoneOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_images_edge_zone'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1133,6 +1150,7 @@ def virtual_machine_run_commands(self): * 2019-12-01: :class:`VirtualMachineRunCommandsOperations` * 2020-06-01: :class:`VirtualMachineRunCommandsOperations` * 2020-12-01: :class:`VirtualMachineRunCommandsOperations` + * 2021-03-01: :class:`VirtualMachineRunCommandsOperations` """ api_version = self._get_api_version('virtual_machine_run_commands') if api_version == '2017-03-30': @@ -1155,6 +1173,8 @@ def virtual_machine_run_commands(self): from ..v2020_06_01.aio.operations import VirtualMachineRunCommandsOperations as OperationClass elif api_version == '2020-12-01': from ..v2020_12_01.aio.operations import VirtualMachineRunCommandsOperations as OperationClass + elif api_version == '2021-03-01': + from ..v2021_03_01.aio.operations import VirtualMachineRunCommandsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_run_commands'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1173,6 +1193,7 @@ def virtual_machine_scale_set_extensions(self): * 2019-12-01: :class:`VirtualMachineScaleSetExtensionsOperations` * 2020-06-01: :class:`VirtualMachineScaleSetExtensionsOperations` * 2020-12-01: :class:`VirtualMachineScaleSetExtensionsOperations` + * 2021-03-01: :class:`VirtualMachineScaleSetExtensionsOperations` """ api_version = self._get_api_version('virtual_machine_scale_set_extensions') if api_version == '2017-03-30': @@ -1195,6 +1216,8 @@ def virtual_machine_scale_set_extensions(self): from ..v2020_06_01.aio.operations import VirtualMachineScaleSetExtensionsOperations as OperationClass elif api_version == '2020-12-01': from ..v2020_12_01.aio.operations import VirtualMachineScaleSetExtensionsOperations as OperationClass + elif api_version == '2021-03-01': + from ..v2021_03_01.aio.operations import VirtualMachineScaleSetExtensionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_scale_set_extensions'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1213,6 +1236,7 @@ def virtual_machine_scale_set_rolling_upgrades(self): * 2019-12-01: :class:`VirtualMachineScaleSetRollingUpgradesOperations` * 2020-06-01: :class:`VirtualMachineScaleSetRollingUpgradesOperations` * 2020-12-01: :class:`VirtualMachineScaleSetRollingUpgradesOperations` + * 2021-03-01: :class:`VirtualMachineScaleSetRollingUpgradesOperations` """ api_version = self._get_api_version('virtual_machine_scale_set_rolling_upgrades') if api_version == '2017-03-30': @@ -1235,6 +1259,8 @@ def virtual_machine_scale_set_rolling_upgrades(self): from ..v2020_06_01.aio.operations import VirtualMachineScaleSetRollingUpgradesOperations as OperationClass elif api_version == '2020-12-01': from ..v2020_12_01.aio.operations import VirtualMachineScaleSetRollingUpgradesOperations as OperationClass + elif api_version == '2021-03-01': + from ..v2021_03_01.aio.operations import VirtualMachineScaleSetRollingUpgradesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_scale_set_rolling_upgrades'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1247,6 +1273,7 @@ def virtual_machine_scale_set_vm_extensions(self): * 2019-12-01: :class:`VirtualMachineScaleSetVMExtensionsOperations` * 2020-06-01: :class:`VirtualMachineScaleSetVMExtensionsOperations` * 2020-12-01: :class:`VirtualMachineScaleSetVMExtensionsOperations` + * 2021-03-01: :class:`VirtualMachineScaleSetVMExtensionsOperations` """ api_version = self._get_api_version('virtual_machine_scale_set_vm_extensions') if api_version == '2019-07-01': @@ -1257,6 +1284,8 @@ def virtual_machine_scale_set_vm_extensions(self): from ..v2020_06_01.aio.operations import VirtualMachineScaleSetVMExtensionsOperations as OperationClass elif api_version == '2020-12-01': from ..v2020_12_01.aio.operations import VirtualMachineScaleSetVMExtensionsOperations as OperationClass + elif api_version == '2021-03-01': + from ..v2021_03_01.aio.operations import VirtualMachineScaleSetVMExtensionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_scale_set_vm_extensions'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1267,12 +1296,15 @@ def virtual_machine_scale_set_vm_run_commands(self): * 2020-06-01: :class:`VirtualMachineScaleSetVMRunCommandsOperations` * 2020-12-01: :class:`VirtualMachineScaleSetVMRunCommandsOperations` + * 2021-03-01: :class:`VirtualMachineScaleSetVMRunCommandsOperations` """ api_version = self._get_api_version('virtual_machine_scale_set_vm_run_commands') if api_version == '2020-06-01': from ..v2020_06_01.aio.operations import VirtualMachineScaleSetVMRunCommandsOperations as OperationClass elif api_version == '2020-12-01': from ..v2020_12_01.aio.operations import VirtualMachineScaleSetVMRunCommandsOperations as OperationClass + elif api_version == '2021-03-01': + from ..v2021_03_01.aio.operations import VirtualMachineScaleSetVMRunCommandsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_scale_set_vm_run_commands'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1294,6 +1326,7 @@ def virtual_machine_scale_set_vms(self): * 2019-12-01: :class:`VirtualMachineScaleSetVMsOperations` * 2020-06-01: :class:`VirtualMachineScaleSetVMsOperations` * 2020-12-01: :class:`VirtualMachineScaleSetVMsOperations` + * 2021-03-01: :class:`VirtualMachineScaleSetVMsOperations` """ api_version = self._get_api_version('virtual_machine_scale_set_vms') if api_version == '2015-06-15': @@ -1322,6 +1355,8 @@ def virtual_machine_scale_set_vms(self): from ..v2020_06_01.aio.operations import VirtualMachineScaleSetVMsOperations as OperationClass elif api_version == '2020-12-01': from ..v2020_12_01.aio.operations import VirtualMachineScaleSetVMsOperations as OperationClass + elif api_version == '2021-03-01': + from ..v2021_03_01.aio.operations import VirtualMachineScaleSetVMsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_scale_set_vms'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1343,6 +1378,7 @@ def virtual_machine_scale_sets(self): * 2019-12-01: :class:`VirtualMachineScaleSetsOperations` * 2020-06-01: :class:`VirtualMachineScaleSetsOperations` * 2020-12-01: :class:`VirtualMachineScaleSetsOperations` + * 2021-03-01: :class:`VirtualMachineScaleSetsOperations` """ api_version = self._get_api_version('virtual_machine_scale_sets') if api_version == '2015-06-15': @@ -1371,6 +1407,8 @@ def virtual_machine_scale_sets(self): from ..v2020_06_01.aio.operations import VirtualMachineScaleSetsOperations as OperationClass elif api_version == '2020-12-01': from ..v2020_12_01.aio.operations import VirtualMachineScaleSetsOperations as OperationClass + elif api_version == '2021-03-01': + from ..v2021_03_01.aio.operations import VirtualMachineScaleSetsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_scale_sets'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1392,6 +1430,7 @@ def virtual_machine_sizes(self): * 2019-12-01: :class:`VirtualMachineSizesOperations` * 2020-06-01: :class:`VirtualMachineSizesOperations` * 2020-12-01: :class:`VirtualMachineSizesOperations` + * 2021-03-01: :class:`VirtualMachineSizesOperations` """ api_version = self._get_api_version('virtual_machine_sizes') if api_version == '2015-06-15': @@ -1420,6 +1459,8 @@ def virtual_machine_sizes(self): from ..v2020_06_01.aio.operations import VirtualMachineSizesOperations as OperationClass elif api_version == '2020-12-01': from ..v2020_12_01.aio.operations import VirtualMachineSizesOperations as OperationClass + elif api_version == '2021-03-01': + from ..v2021_03_01.aio.operations import VirtualMachineSizesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machine_sizes'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -1441,6 +1482,7 @@ def virtual_machines(self): * 2019-12-01: :class:`VirtualMachinesOperations` * 2020-06-01: :class:`VirtualMachinesOperations` * 2020-12-01: :class:`VirtualMachinesOperations` + * 2021-03-01: :class:`VirtualMachinesOperations` """ api_version = self._get_api_version('virtual_machines') if api_version == '2015-06-15': @@ -1469,6 +1511,8 @@ def virtual_machines(self): from ..v2020_06_01.aio.operations import VirtualMachinesOperations as OperationClass elif api_version == '2020-12-01': from ..v2020_12_01.aio.operations import VirtualMachinesOperations as OperationClass + elif api_version == '2021-03-01': + from ..v2021_03_01.aio.operations import VirtualMachinesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'virtual_machines'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_compute_management_client.py index 571c4117325ee..d49252aa3ba6e 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_compute_management_client.py @@ -23,6 +23,28 @@ from .operations import CloudServicesOperations from .operations import CloudServicesUpdateDomainOperations from .operations import CloudServiceOperatingSystemsOperations +from .operations import Operations +from .operations import AvailabilitySetsOperations +from .operations import ProximityPlacementGroupsOperations +from .operations import DedicatedHostGroupsOperations +from .operations import DedicatedHostsOperations +from .operations import SshPublicKeysOperations +from .operations import VirtualMachineExtensionImagesOperations +from .operations import VirtualMachineExtensionsOperations +from .operations import VirtualMachineImagesOperations +from .operations import VirtualMachineImagesEdgeZoneOperations +from .operations import UsageOperations +from .operations import VirtualMachinesOperations +from .operations import VirtualMachineScaleSetsOperations +from .operations import VirtualMachineSizesOperations +from .operations import ImagesOperations +from .operations import VirtualMachineScaleSetExtensionsOperations +from .operations import VirtualMachineScaleSetRollingUpgradesOperations +from .operations import VirtualMachineScaleSetVMExtensionsOperations +from .operations import VirtualMachineScaleSetVMsOperations +from .operations import LogAnalyticsOperations +from .operations import VirtualMachineRunCommandsOperations +from .operations import VirtualMachineScaleSetVMRunCommandsOperations from . import models @@ -39,6 +61,50 @@ class ComputeManagementClient(object): :vartype cloud_services_update_domain: azure.mgmt.compute.v2021_03_01.operations.CloudServicesUpdateDomainOperations :ivar cloud_service_operating_systems: CloudServiceOperatingSystemsOperations operations :vartype cloud_service_operating_systems: azure.mgmt.compute.v2021_03_01.operations.CloudServiceOperatingSystemsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.compute.v2021_03_01.operations.Operations + :ivar availability_sets: AvailabilitySetsOperations operations + :vartype availability_sets: azure.mgmt.compute.v2021_03_01.operations.AvailabilitySetsOperations + :ivar proximity_placement_groups: ProximityPlacementGroupsOperations operations + :vartype proximity_placement_groups: azure.mgmt.compute.v2021_03_01.operations.ProximityPlacementGroupsOperations + :ivar dedicated_host_groups: DedicatedHostGroupsOperations operations + :vartype dedicated_host_groups: azure.mgmt.compute.v2021_03_01.operations.DedicatedHostGroupsOperations + :ivar dedicated_hosts: DedicatedHostsOperations operations + :vartype dedicated_hosts: azure.mgmt.compute.v2021_03_01.operations.DedicatedHostsOperations + :ivar ssh_public_keys: SshPublicKeysOperations operations + :vartype ssh_public_keys: azure.mgmt.compute.v2021_03_01.operations.SshPublicKeysOperations + :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations + :vartype virtual_machine_extension_images: azure.mgmt.compute.v2021_03_01.operations.VirtualMachineExtensionImagesOperations + :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations + :vartype virtual_machine_extensions: azure.mgmt.compute.v2021_03_01.operations.VirtualMachineExtensionsOperations + :ivar virtual_machine_images: VirtualMachineImagesOperations operations + :vartype virtual_machine_images: azure.mgmt.compute.v2021_03_01.operations.VirtualMachineImagesOperations + :ivar virtual_machine_images_edge_zone: VirtualMachineImagesEdgeZoneOperations operations + :vartype virtual_machine_images_edge_zone: azure.mgmt.compute.v2021_03_01.operations.VirtualMachineImagesEdgeZoneOperations + :ivar usage: UsageOperations operations + :vartype usage: azure.mgmt.compute.v2021_03_01.operations.UsageOperations + :ivar virtual_machines: VirtualMachinesOperations operations + :vartype virtual_machines: azure.mgmt.compute.v2021_03_01.operations.VirtualMachinesOperations + :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations + :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2021_03_01.operations.VirtualMachineScaleSetsOperations + :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations + :vartype virtual_machine_sizes: azure.mgmt.compute.v2021_03_01.operations.VirtualMachineSizesOperations + :ivar images: ImagesOperations operations + :vartype images: azure.mgmt.compute.v2021_03_01.operations.ImagesOperations + :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations operations + :vartype virtual_machine_scale_set_extensions: azure.mgmt.compute.v2021_03_01.operations.VirtualMachineScaleSetExtensionsOperations + :ivar virtual_machine_scale_set_rolling_upgrades: VirtualMachineScaleSetRollingUpgradesOperations operations + :vartype virtual_machine_scale_set_rolling_upgrades: azure.mgmt.compute.v2021_03_01.operations.VirtualMachineScaleSetRollingUpgradesOperations + :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations operations + :vartype virtual_machine_scale_set_vm_extensions: azure.mgmt.compute.v2021_03_01.operations.VirtualMachineScaleSetVMExtensionsOperations + :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations + :vartype virtual_machine_scale_set_vms: azure.mgmt.compute.v2021_03_01.operations.VirtualMachineScaleSetVMsOperations + :ivar log_analytics: LogAnalyticsOperations operations + :vartype log_analytics: azure.mgmt.compute.v2021_03_01.operations.LogAnalyticsOperations + :ivar virtual_machine_run_commands: VirtualMachineRunCommandsOperations operations + :vartype virtual_machine_run_commands: azure.mgmt.compute.v2021_03_01.operations.VirtualMachineRunCommandsOperations + :ivar virtual_machine_scale_set_vm_run_commands: VirtualMachineScaleSetVMRunCommandsOperations operations + :vartype virtual_machine_scale_set_vm_run_commands: azure.mgmt.compute.v2021_03_01.operations.VirtualMachineScaleSetVMRunCommandsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. @@ -75,6 +141,50 @@ def __init__( self._client, self._config, self._serialize, self._deserialize) self.cloud_service_operating_systems = CloudServiceOperatingSystemsOperations( self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.availability_sets = AvailabilitySetsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.proximity_placement_groups = ProximityPlacementGroupsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.dedicated_host_groups = DedicatedHostGroupsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.dedicated_hosts = DedicatedHostsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.ssh_public_keys = SshPublicKeysOperations( + self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_extension_images = VirtualMachineExtensionImagesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_extensions = VirtualMachineExtensionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_images = VirtualMachineImagesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_images_edge_zone = VirtualMachineImagesEdgeZoneOperations( + self._client, self._config, self._serialize, self._deserialize) + self.usage = UsageOperations( + self._client, self._config, self._serialize, self._deserialize) + self.virtual_machines = VirtualMachinesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_scale_sets = VirtualMachineScaleSetsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_sizes = VirtualMachineSizesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.images = ImagesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_scale_set_extensions = VirtualMachineScaleSetExtensionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_scale_set_rolling_upgrades = VirtualMachineScaleSetRollingUpgradesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_scale_set_vm_extensions = VirtualMachineScaleSetVMExtensionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_scale_set_vms = VirtualMachineScaleSetVMsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.log_analytics = LogAnalyticsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_run_commands = VirtualMachineRunCommandsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_scale_set_vm_run_commands = VirtualMachineScaleSetVMRunCommandsOperations( + self._client, self._config, self._serialize, self._deserialize) def close(self): # type: () -> None diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_metadata.json b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_metadata.json index 41965868dd368..7d2dd7b68c6d5 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_metadata.json +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/_metadata.json @@ -102,7 +102,29 @@ "cloud_service_roles": "CloudServiceRolesOperations", "cloud_services": "CloudServicesOperations", "cloud_services_update_domain": "CloudServicesUpdateDomainOperations", - "cloud_service_operating_systems": "CloudServiceOperatingSystemsOperations" + "cloud_service_operating_systems": "CloudServiceOperatingSystemsOperations", + "operations": "Operations", + "availability_sets": "AvailabilitySetsOperations", + "proximity_placement_groups": "ProximityPlacementGroupsOperations", + "dedicated_host_groups": "DedicatedHostGroupsOperations", + "dedicated_hosts": "DedicatedHostsOperations", + "ssh_public_keys": "SshPublicKeysOperations", + "virtual_machine_extension_images": "VirtualMachineExtensionImagesOperations", + "virtual_machine_extensions": "VirtualMachineExtensionsOperations", + "virtual_machine_images": "VirtualMachineImagesOperations", + "virtual_machine_images_edge_zone": "VirtualMachineImagesEdgeZoneOperations", + "usage": "UsageOperations", + "virtual_machines": "VirtualMachinesOperations", + "virtual_machine_scale_sets": "VirtualMachineScaleSetsOperations", + "virtual_machine_sizes": "VirtualMachineSizesOperations", + "images": "ImagesOperations", + "virtual_machine_scale_set_extensions": "VirtualMachineScaleSetExtensionsOperations", + "virtual_machine_scale_set_rolling_upgrades": "VirtualMachineScaleSetRollingUpgradesOperations", + "virtual_machine_scale_set_vm_extensions": "VirtualMachineScaleSetVMExtensionsOperations", + "virtual_machine_scale_set_vms": "VirtualMachineScaleSetVMsOperations", + "log_analytics": "LogAnalyticsOperations", + "virtual_machine_run_commands": "VirtualMachineRunCommandsOperations", + "virtual_machine_scale_set_vm_run_commands": "VirtualMachineScaleSetVMRunCommandsOperations" }, "operation_mixins": { "sync_imports": "None", diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/_compute_management_client.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/_compute_management_client.py index f0942db6f954a..f15928b0fdb8d 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/_compute_management_client.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/_compute_management_client.py @@ -21,6 +21,28 @@ from .operations import CloudServicesOperations from .operations import CloudServicesUpdateDomainOperations from .operations import CloudServiceOperatingSystemsOperations +from .operations import Operations +from .operations import AvailabilitySetsOperations +from .operations import ProximityPlacementGroupsOperations +from .operations import DedicatedHostGroupsOperations +from .operations import DedicatedHostsOperations +from .operations import SshPublicKeysOperations +from .operations import VirtualMachineExtensionImagesOperations +from .operations import VirtualMachineExtensionsOperations +from .operations import VirtualMachineImagesOperations +from .operations import VirtualMachineImagesEdgeZoneOperations +from .operations import UsageOperations +from .operations import VirtualMachinesOperations +from .operations import VirtualMachineScaleSetsOperations +from .operations import VirtualMachineSizesOperations +from .operations import ImagesOperations +from .operations import VirtualMachineScaleSetExtensionsOperations +from .operations import VirtualMachineScaleSetRollingUpgradesOperations +from .operations import VirtualMachineScaleSetVMExtensionsOperations +from .operations import VirtualMachineScaleSetVMsOperations +from .operations import LogAnalyticsOperations +from .operations import VirtualMachineRunCommandsOperations +from .operations import VirtualMachineScaleSetVMRunCommandsOperations from .. import models @@ -37,6 +59,50 @@ class ComputeManagementClient(object): :vartype cloud_services_update_domain: azure.mgmt.compute.v2021_03_01.aio.operations.CloudServicesUpdateDomainOperations :ivar cloud_service_operating_systems: CloudServiceOperatingSystemsOperations operations :vartype cloud_service_operating_systems: azure.mgmt.compute.v2021_03_01.aio.operations.CloudServiceOperatingSystemsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.compute.v2021_03_01.aio.operations.Operations + :ivar availability_sets: AvailabilitySetsOperations operations + :vartype availability_sets: azure.mgmt.compute.v2021_03_01.aio.operations.AvailabilitySetsOperations + :ivar proximity_placement_groups: ProximityPlacementGroupsOperations operations + :vartype proximity_placement_groups: azure.mgmt.compute.v2021_03_01.aio.operations.ProximityPlacementGroupsOperations + :ivar dedicated_host_groups: DedicatedHostGroupsOperations operations + :vartype dedicated_host_groups: azure.mgmt.compute.v2021_03_01.aio.operations.DedicatedHostGroupsOperations + :ivar dedicated_hosts: DedicatedHostsOperations operations + :vartype dedicated_hosts: azure.mgmt.compute.v2021_03_01.aio.operations.DedicatedHostsOperations + :ivar ssh_public_keys: SshPublicKeysOperations operations + :vartype ssh_public_keys: azure.mgmt.compute.v2021_03_01.aio.operations.SshPublicKeysOperations + :ivar virtual_machine_extension_images: VirtualMachineExtensionImagesOperations operations + :vartype virtual_machine_extension_images: azure.mgmt.compute.v2021_03_01.aio.operations.VirtualMachineExtensionImagesOperations + :ivar virtual_machine_extensions: VirtualMachineExtensionsOperations operations + :vartype virtual_machine_extensions: azure.mgmt.compute.v2021_03_01.aio.operations.VirtualMachineExtensionsOperations + :ivar virtual_machine_images: VirtualMachineImagesOperations operations + :vartype virtual_machine_images: azure.mgmt.compute.v2021_03_01.aio.operations.VirtualMachineImagesOperations + :ivar virtual_machine_images_edge_zone: VirtualMachineImagesEdgeZoneOperations operations + :vartype virtual_machine_images_edge_zone: azure.mgmt.compute.v2021_03_01.aio.operations.VirtualMachineImagesEdgeZoneOperations + :ivar usage: UsageOperations operations + :vartype usage: azure.mgmt.compute.v2021_03_01.aio.operations.UsageOperations + :ivar virtual_machines: VirtualMachinesOperations operations + :vartype virtual_machines: azure.mgmt.compute.v2021_03_01.aio.operations.VirtualMachinesOperations + :ivar virtual_machine_scale_sets: VirtualMachineScaleSetsOperations operations + :vartype virtual_machine_scale_sets: azure.mgmt.compute.v2021_03_01.aio.operations.VirtualMachineScaleSetsOperations + :ivar virtual_machine_sizes: VirtualMachineSizesOperations operations + :vartype virtual_machine_sizes: azure.mgmt.compute.v2021_03_01.aio.operations.VirtualMachineSizesOperations + :ivar images: ImagesOperations operations + :vartype images: azure.mgmt.compute.v2021_03_01.aio.operations.ImagesOperations + :ivar virtual_machine_scale_set_extensions: VirtualMachineScaleSetExtensionsOperations operations + :vartype virtual_machine_scale_set_extensions: azure.mgmt.compute.v2021_03_01.aio.operations.VirtualMachineScaleSetExtensionsOperations + :ivar virtual_machine_scale_set_rolling_upgrades: VirtualMachineScaleSetRollingUpgradesOperations operations + :vartype virtual_machine_scale_set_rolling_upgrades: azure.mgmt.compute.v2021_03_01.aio.operations.VirtualMachineScaleSetRollingUpgradesOperations + :ivar virtual_machine_scale_set_vm_extensions: VirtualMachineScaleSetVMExtensionsOperations operations + :vartype virtual_machine_scale_set_vm_extensions: azure.mgmt.compute.v2021_03_01.aio.operations.VirtualMachineScaleSetVMExtensionsOperations + :ivar virtual_machine_scale_set_vms: VirtualMachineScaleSetVMsOperations operations + :vartype virtual_machine_scale_set_vms: azure.mgmt.compute.v2021_03_01.aio.operations.VirtualMachineScaleSetVMsOperations + :ivar log_analytics: LogAnalyticsOperations operations + :vartype log_analytics: azure.mgmt.compute.v2021_03_01.aio.operations.LogAnalyticsOperations + :ivar virtual_machine_run_commands: VirtualMachineRunCommandsOperations operations + :vartype virtual_machine_run_commands: azure.mgmt.compute.v2021_03_01.aio.operations.VirtualMachineRunCommandsOperations + :ivar virtual_machine_scale_set_vm_run_commands: VirtualMachineScaleSetVMRunCommandsOperations operations + :vartype virtual_machine_scale_set_vm_run_commands: azure.mgmt.compute.v2021_03_01.aio.operations.VirtualMachineScaleSetVMRunCommandsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. @@ -72,6 +138,50 @@ def __init__( self._client, self._config, self._serialize, self._deserialize) self.cloud_service_operating_systems = CloudServiceOperatingSystemsOperations( self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.availability_sets = AvailabilitySetsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.proximity_placement_groups = ProximityPlacementGroupsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.dedicated_host_groups = DedicatedHostGroupsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.dedicated_hosts = DedicatedHostsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.ssh_public_keys = SshPublicKeysOperations( + self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_extension_images = VirtualMachineExtensionImagesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_extensions = VirtualMachineExtensionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_images = VirtualMachineImagesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_images_edge_zone = VirtualMachineImagesEdgeZoneOperations( + self._client, self._config, self._serialize, self._deserialize) + self.usage = UsageOperations( + self._client, self._config, self._serialize, self._deserialize) + self.virtual_machines = VirtualMachinesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_scale_sets = VirtualMachineScaleSetsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_sizes = VirtualMachineSizesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.images = ImagesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_scale_set_extensions = VirtualMachineScaleSetExtensionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_scale_set_rolling_upgrades = VirtualMachineScaleSetRollingUpgradesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_scale_set_vm_extensions = VirtualMachineScaleSetVMExtensionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_scale_set_vms = VirtualMachineScaleSetVMsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.log_analytics = LogAnalyticsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_run_commands = VirtualMachineRunCommandsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.virtual_machine_scale_set_vm_run_commands = VirtualMachineScaleSetVMRunCommandsOperations( + self._client, self._config, self._serialize, self._deserialize) async def close(self) -> None: await self._client.close() diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/__init__.py index 4e620f184dcb1..3c3908367f0ce 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/__init__.py @@ -11,6 +11,28 @@ from ._cloud_services_operations import CloudServicesOperations from ._cloud_services_update_domain_operations import CloudServicesUpdateDomainOperations from ._cloud_service_operating_systems_operations import CloudServiceOperatingSystemsOperations +from ._operations import Operations +from ._availability_sets_operations import AvailabilitySetsOperations +from ._proximity_placement_groups_operations import ProximityPlacementGroupsOperations +from ._dedicated_host_groups_operations import DedicatedHostGroupsOperations +from ._dedicated_hosts_operations import DedicatedHostsOperations +from ._ssh_public_keys_operations import SshPublicKeysOperations +from ._virtual_machine_extension_images_operations import VirtualMachineExtensionImagesOperations +from ._virtual_machine_extensions_operations import VirtualMachineExtensionsOperations +from ._virtual_machine_images_operations import VirtualMachineImagesOperations +from ._virtual_machine_images_edge_zone_operations import VirtualMachineImagesEdgeZoneOperations +from ._usage_operations import UsageOperations +from ._virtual_machines_operations import VirtualMachinesOperations +from ._virtual_machine_scale_sets_operations import VirtualMachineScaleSetsOperations +from ._virtual_machine_sizes_operations import VirtualMachineSizesOperations +from ._images_operations import ImagesOperations +from ._virtual_machine_scale_set_extensions_operations import VirtualMachineScaleSetExtensionsOperations +from ._virtual_machine_scale_set_rolling_upgrades_operations import VirtualMachineScaleSetRollingUpgradesOperations +from ._virtual_machine_scale_set_vm_extensions_operations import VirtualMachineScaleSetVMExtensionsOperations +from ._virtual_machine_scale_set_vms_operations import VirtualMachineScaleSetVMsOperations +from ._log_analytics_operations import LogAnalyticsOperations +from ._virtual_machine_run_commands_operations import VirtualMachineRunCommandsOperations +from ._virtual_machine_scale_set_vm_run_commands_operations import VirtualMachineScaleSetVMRunCommandsOperations __all__ = [ 'CloudServiceRoleInstancesOperations', @@ -18,4 +40,26 @@ 'CloudServicesOperations', 'CloudServicesUpdateDomainOperations', 'CloudServiceOperatingSystemsOperations', + 'Operations', + 'AvailabilitySetsOperations', + 'ProximityPlacementGroupsOperations', + 'DedicatedHostGroupsOperations', + 'DedicatedHostsOperations', + 'SshPublicKeysOperations', + 'VirtualMachineExtensionImagesOperations', + 'VirtualMachineExtensionsOperations', + 'VirtualMachineImagesOperations', + 'VirtualMachineImagesEdgeZoneOperations', + 'UsageOperations', + 'VirtualMachinesOperations', + 'VirtualMachineScaleSetsOperations', + 'VirtualMachineSizesOperations', + 'ImagesOperations', + 'VirtualMachineScaleSetExtensionsOperations', + 'VirtualMachineScaleSetRollingUpgradesOperations', + 'VirtualMachineScaleSetVMExtensionsOperations', + 'VirtualMachineScaleSetVMsOperations', + 'LogAnalyticsOperations', + 'VirtualMachineRunCommandsOperations', + 'VirtualMachineScaleSetVMRunCommandsOperations', ] diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_availability_sets_operations.py new file mode 100644 index 0000000000000..616957639d9f4 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_availability_sets_operations.py @@ -0,0 +1,502 @@ +# 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, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class AvailabilitySetsOperations: + """AvailabilitySetsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def create_or_update( + self, + resource_group_name: str, + availability_set_name: str, + parameters: "_models.AvailabilitySet", + **kwargs + ) -> "_models.AvailabilitySet": + """Create or update an availability set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. + :type availability_set_name: str + :param parameters: Parameters supplied to the Create Availability Set operation. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.AvailabilitySet + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AvailabilitySet, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.AvailabilitySet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'availabilitySetName': self._serialize.url("availability_set_name", availability_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'AvailabilitySet') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AvailabilitySet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + availability_set_name: str, + parameters: "_models.AvailabilitySetUpdate", + **kwargs + ) -> "_models.AvailabilitySet": + """Update an availability set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. + :type availability_set_name: str + :param parameters: Parameters supplied to the Update Availability Set operation. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.AvailabilitySetUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AvailabilitySet, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.AvailabilitySet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'availabilitySetName': self._serialize.url("availability_set_name", availability_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'AvailabilitySetUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AvailabilitySet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + availability_set_name: str, + **kwargs + ) -> None: + """Delete an availability set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. + :type availability_set_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 + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'availabilitySetName': self._serialize.url("availability_set_name", availability_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + availability_set_name: str, + **kwargs + ) -> "_models.AvailabilitySet": + """Retrieves information about an availability set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. + :type availability_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AvailabilitySet, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.AvailabilitySet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'availabilitySetName': self._serialize.url("availability_set_name", availability_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AvailabilitySet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + def list_by_subscription( + self, + expand: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.AvailabilitySetListResult"]: + """Lists all availability sets in a subscription. + + :param expand: The expand expression to apply to the operation. Allowed values are + 'instanceView'. + :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 AvailabilitySetListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.AvailabilitySetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + + def list( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["_models.AvailabilitySetListResult"]: + """Lists all availability sets in a resource group. + + :param resource_group_name: The name of the resource group. + :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 AvailabilitySetListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.AvailabilitySetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + + def list_available_sizes( + self, + resource_group_name: str, + availability_set_name: str, + **kwargs + ) -> AsyncIterable["_models.VirtualMachineSizeListResult"]: + """Lists all available virtual machine sizes that can be used to create a new virtual machine in + an existing availability set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. + :type availability_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineSizeListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_available_sizes.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'availabilitySetName': self._serialize.url("availability_set_name", availability_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_available_sizes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_service_role_instances_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_service_role_instances_operations.py index 9a7e9fe596692..9c5d5c3a5a9a3 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_service_role_instances_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_cloud_service_role_instances_operations.py @@ -163,7 +163,7 @@ async def get( role_instance_name: str, resource_group_name: str, cloud_service_name: str, - expand: Optional[str] = "instanceView", + expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, **kwargs ) -> "_models.RoleInstance": """Gets a role instance from a cloud service. @@ -175,7 +175,7 @@ async def get( :param cloud_service_name: :type cloud_service_name: str :param expand: The expand expression to apply to the operation. - :type expand: str + :type expand: str or ~azure.mgmt.compute.v2021_03_01.models.InstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response :return: RoleInstance, or the result of cls(response) :rtype: ~azure.mgmt.compute.v2021_03_01.models.RoleInstance @@ -291,7 +291,7 @@ def list( self, resource_group_name: str, cloud_service_name: str, - expand: Optional[str] = "instanceView", + expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, **kwargs ) -> AsyncIterable["_models.RoleInstanceListResult"]: """Gets the list of all role instances in a cloud service. Use nextLink property in the response @@ -303,7 +303,7 @@ def list( :param cloud_service_name: :type cloud_service_name: str :param expand: The expand expression to apply to the operation. - :type expand: str + :type expand: str or ~azure.mgmt.compute.v2021_03_01.models.InstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RoleInstanceListResult or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.RoleInstanceListResult] diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_dedicated_host_groups_operations.py new file mode 100644 index 0000000000000..9e95eb55b619b --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_dedicated_host_groups_operations.py @@ -0,0 +1,435 @@ +# 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, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DedicatedHostGroupsOperations: + """DedicatedHostGroupsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def create_or_update( + self, + resource_group_name: str, + host_group_name: str, + parameters: "_models.DedicatedHostGroup", + **kwargs + ) -> "_models.DedicatedHostGroup": + """Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host + Groups please see [Dedicated Host Documentation] + (https://go.microsoft.com/fwlink/?linkid=2082596). + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_group_name: str + :param parameters: Parameters supplied to the Create Dedicated Host Group. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.DedicatedHostGroup + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DedicatedHostGroup, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.DedicatedHostGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'hostGroupName': self._serialize.url("host_group_name", host_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'DedicatedHostGroup') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DedicatedHostGroup', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DedicatedHostGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + host_group_name: str, + parameters: "_models.DedicatedHostGroupUpdate", + **kwargs + ) -> "_models.DedicatedHostGroup": + """Update an dedicated host group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_group_name: str + :param parameters: Parameters supplied to the Update Dedicated Host Group operation. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.DedicatedHostGroupUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DedicatedHostGroup, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.DedicatedHostGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'hostGroupName': self._serialize.url("host_group_name", host_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'DedicatedHostGroupUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DedicatedHostGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + host_group_name: str, + **kwargs + ) -> None: + """Delete a dedicated host group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_group_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 + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'hostGroupName': self._serialize.url("host_group_name", host_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + host_group_name: str, + expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, + **kwargs + ) -> "_models.DedicatedHostGroup": + """Retrieves information about a dedicated host group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_group_name: str + :param expand: The expand expression to apply on the operation. The response shows the list of + instance view of the dedicated hosts under the dedicated host group. + :type expand: str or ~azure.mgmt.compute.v2021_03_01.models.InstanceViewTypes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DedicatedHostGroup, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.DedicatedHostGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'hostGroupName': self._serialize.url("host_group_name", host_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DedicatedHostGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["_models.DedicatedHostGroupListResult"]: + """Lists all of the dedicated host groups in the specified resource group. Use the nextLink + property in the response to get the next page of dedicated host groups. + + :param resource_group_name: The name of the resource group. + :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 DedicatedHostGroupListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.DedicatedHostGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DedicatedHostGroupListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups'} # type: ignore + + def list_by_subscription( + self, + **kwargs + ) -> AsyncIterable["_models.DedicatedHostGroupListResult"]: + """Lists all of the dedicated host groups in the subscription. Use the nextLink property in the + response to get the next page of dedicated host groups. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DedicatedHostGroupListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.DedicatedHostGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DedicatedHostGroupListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/hostGroups'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_dedicated_hosts_operations.py new file mode 100644 index 0000000000000..ba20a397be3e8 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_dedicated_hosts_operations.py @@ -0,0 +1,565 @@ +# 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, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DedicatedHostsOperations: + """DedicatedHostsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _create_or_update_initial( + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHost", + **kwargs + ) -> "_models.DedicatedHost": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'hostGroupName': self._serialize.url("host_group_name", host_group_name, 'str'), + 'hostName': self._serialize.url("host_name", host_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'DedicatedHost') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DedicatedHost', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DedicatedHost', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHost", + **kwargs + ) -> AsyncLROPoller["_models.DedicatedHost"]: + """Create or update a dedicated host . + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_group_name: str + :param host_name: The name of the dedicated host . + :type host_name: str + :param parameters: Parameters supplied to the Create Dedicated Host. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.DedicatedHost + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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 DedicatedHost or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.DedicatedHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DedicatedHost', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'hostGroupName': self._serialize.url("host_group_name", host_group_name, 'str'), + 'hostName': self._serialize.url("host_name", host_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHostUpdate", + **kwargs + ) -> "_models.DedicatedHost": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'hostGroupName': self._serialize.url("host_group_name", host_group_name, 'str'), + 'hostName': self._serialize.url("host_name", host_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'DedicatedHostUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DedicatedHost', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + parameters: "_models.DedicatedHostUpdate", + **kwargs + ) -> AsyncLROPoller["_models.DedicatedHost"]: + """Update an dedicated host . + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_group_name: str + :param host_name: The name of the dedicated host . + :type host_name: str + :param parameters: Parameters supplied to the Update Dedicated Host operation. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.DedicatedHostUpdate + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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 DedicatedHost or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.DedicatedHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DedicatedHost', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'hostGroupName': self._serialize.url("host_group_name", host_group_name, 'str'), + 'hostName': self._serialize.url("host_name", host_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'hostGroupName': self._serialize.url("host_group_name", host_group_name, 'str'), + 'hostName': self._serialize.url("host_name", host_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Delete a dedicated host. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_group_name: str + :param host_name: The name of the dedicated host. + :type host_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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'hostGroupName': self._serialize.url("host_group_name", host_group_name, 'str'), + 'hostName': self._serialize.url("host_name", host_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + host_group_name: str, + host_name: str, + expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, + **kwargs + ) -> "_models.DedicatedHost": + """Retrieves information about a dedicated host. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_group_name: str + :param host_name: The name of the dedicated host. + :type host_name: str + :param expand: The expand expression to apply on the operation. + :type expand: str or ~azure.mgmt.compute.v2021_03_01.models.InstanceViewTypes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DedicatedHost, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.DedicatedHost + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'hostGroupName': self._serialize.url("host_group_name", host_group_name, 'str'), + 'hostName': self._serialize.url("host_name", host_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DedicatedHost', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + def list_by_host_group( + self, + resource_group_name: str, + host_group_name: str, + **kwargs + ) -> AsyncIterable["_models.DedicatedHostListResult"]: + """Lists all of the dedicated hosts in the specified dedicated host group. Use the nextLink + property in the response to get the next page of dedicated hosts. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_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 DedicatedHostListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.DedicatedHostListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_host_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'hostGroupName': self._serialize.url("host_group_name", host_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DedicatedHostListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_host_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_images_operations.py new file mode 100644 index 0000000000000..d694ad6e52b56 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_images_operations.py @@ -0,0 +1,606 @@ +# 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, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ImagesOperations: + """ImagesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _create_or_update_initial( + self, + resource_group_name: str, + image_name: str, + parameters: "_models.Image", + **kwargs + ) -> "_models.Image": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'imageName': self._serialize.url("image_name", image_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Image') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Image', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Image', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + image_name: str, + parameters: "_models.Image", + **kwargs + ) -> AsyncLROPoller["_models.Image"]: + """Create or update an image. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param image_name: The name of the image. + :type image_name: str + :param parameters: Parameters supplied to the Create Image operation. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.Image + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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 Image or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.Image] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + image_name=image_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Image', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'imageName': self._serialize.url("image_name", image_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + image_name: str, + parameters: "_models.ImageUpdate", + **kwargs + ) -> "_models.Image": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'imageName': self._serialize.url("image_name", image_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ImageUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Image', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Image', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + image_name: str, + parameters: "_models.ImageUpdate", + **kwargs + ) -> AsyncLROPoller["_models.Image"]: + """Update an image. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param image_name: The name of the image. + :type image_name: str + :param parameters: Parameters supplied to the Update Image operation. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.ImageUpdate + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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 Image or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.Image] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + image_name=image_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Image', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'imageName': self._serialize.url("image_name", image_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + image_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'imageName': self._serialize.url("image_name", image_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + image_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes an Image. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param image_name: The name of the image. + :type image_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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + image_name=image_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'imageName': self._serialize.url("image_name", image_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + image_name: str, + expand: Optional[str] = None, + **kwargs + ) -> "_models.Image": + """Gets an image. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param image_name: The name of the image. + :type image_name: str + :param expand: The expand expression to apply on the operation. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Image, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.Image + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'imageName': self._serialize.url("image_name", image_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Image', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["_models.ImageListResult"]: + """Gets the list of images under a resource group. + + :param resource_group_name: The name of the resource group. + :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 ImageListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.ImageListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ImageListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images'} # type: ignore + + def list( + self, + **kwargs + ) -> AsyncIterable["_models.ImageListResult"]: + """Gets the list of Images in the subscription. Use nextLink property in the response to get the + next page of Images. Do this till nextLink is null to fetch all the Images. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ImageListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.ImageListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ImageListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_log_analytics_operations.py new file mode 100644 index 0000000000000..38e408b9dc1e8 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_log_analytics_operations.py @@ -0,0 +1,283 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class LogAnalyticsOperations: + """LogAnalyticsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _export_request_rate_by_interval_initial( + self, + location: str, + parameters: "_models.RequestRateByIntervalInput", + **kwargs + ) -> Optional["_models.LogAnalyticsOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LogAnalyticsOperationResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._export_request_rate_by_interval_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RequestRateByIntervalInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('LogAnalyticsOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _export_request_rate_by_interval_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval'} # type: ignore + + async def begin_export_request_rate_by_interval( + self, + location: str, + parameters: "_models.RequestRateByIntervalInput", + **kwargs + ) -> AsyncLROPoller["_models.LogAnalyticsOperationResult"]: + """Export logs that show Api requests made by this subscription in the given time window to show + throttling activities. + + :param location: The location upon which virtual-machine-sizes is queried. + :type location: str + :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.RequestRateByIntervalInput + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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 LogAnalyticsOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.LogAnalyticsOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._export_request_rate_by_interval_initial( + location=location, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('LogAnalyticsOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_export_request_rate_by_interval.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval'} # type: ignore + + async def _export_throttled_requests_initial( + self, + location: str, + parameters: "_models.ThrottledRequestsInput", + **kwargs + ) -> Optional["_models.LogAnalyticsOperationResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LogAnalyticsOperationResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._export_throttled_requests_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ThrottledRequestsInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('LogAnalyticsOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _export_throttled_requests_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests'} # type: ignore + + async def begin_export_throttled_requests( + self, + location: str, + parameters: "_models.ThrottledRequestsInput", + **kwargs + ) -> AsyncLROPoller["_models.LogAnalyticsOperationResult"]: + """Export logs that show total throttled Api requests for this subscription in the given time + window. + + :param location: The location upon which virtual-machine-sizes is queried. + :type location: str + :param parameters: Parameters supplied to the LogAnalytics getThrottledRequests Api. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.ThrottledRequestsInput + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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 LogAnalyticsOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.LogAnalyticsOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._export_throttled_requests_initial( + location=location, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('LogAnalyticsOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_export_throttled_requests.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_operations.py new file mode 100644 index 0000000000000..e84b3f390d556 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_operations.py @@ -0,0 +1,104 @@ +# 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, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs + ) -> AsyncIterable["_models.ComputeOperationListResult"]: + """Gets a list of compute operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ComputeOperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.ComputeOperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ComputeOperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Compute/operations'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_proximity_placement_groups_operations.py new file mode 100644 index 0000000000000..c5d307810119e --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_proximity_placement_groups_operations.py @@ -0,0 +1,431 @@ +# 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, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ProximityPlacementGroupsOperations: + """ProximityPlacementGroupsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def create_or_update( + self, + resource_group_name: str, + proximity_placement_group_name: str, + parameters: "_models.ProximityPlacementGroup", + **kwargs + ) -> "_models.ProximityPlacementGroup": + """Create or update a proximity placement group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. + :type proximity_placement_group_name: str + :param parameters: Parameters supplied to the Create Proximity Placement Group operation. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.ProximityPlacementGroup + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProximityPlacementGroup, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.ProximityPlacementGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'proximityPlacementGroupName': self._serialize.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ProximityPlacementGroup') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ProximityPlacementGroup', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ProximityPlacementGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + proximity_placement_group_name: str, + parameters: "_models.ProximityPlacementGroupUpdate", + **kwargs + ) -> "_models.ProximityPlacementGroup": + """Update a proximity placement group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. + :type proximity_placement_group_name: str + :param parameters: Parameters supplied to the Update Proximity Placement Group operation. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.ProximityPlacementGroupUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProximityPlacementGroup, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.ProximityPlacementGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'proximityPlacementGroupName': self._serialize.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ProximityPlacementGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + proximity_placement_group_name: str, + **kwargs + ) -> None: + """Delete a proximity placement group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. + :type proximity_placement_group_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 + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'proximityPlacementGroupName': self._serialize.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + proximity_placement_group_name: str, + include_colocation_status: Optional[str] = None, + **kwargs + ) -> "_models.ProximityPlacementGroup": + """Retrieves information about a proximity placement group . + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. + :type proximity_placement_group_name: str + :param include_colocation_status: includeColocationStatus=true enables fetching the colocation + status of all the resources in the proximity placement group. + :type include_colocation_status: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProximityPlacementGroup, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.ProximityPlacementGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'proximityPlacementGroupName': self._serialize.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if include_colocation_status is not None: + query_parameters['includeColocationStatus'] = self._serialize.query("include_colocation_status", include_colocation_status, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ProximityPlacementGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + def list_by_subscription( + self, + **kwargs + ) -> AsyncIterable["_models.ProximityPlacementGroupListResult"]: + """Lists all proximity placement groups 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 ProximityPlacementGroupListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.ProximityPlacementGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["_models.ProximityPlacementGroupListResult"]: + """Lists all proximity placement groups in a resource group. + + :param resource_group_name: The name of the resource group. + :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 ProximityPlacementGroupListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.ProximityPlacementGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_ssh_public_keys_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_ssh_public_keys_operations.py new file mode 100644 index 0000000000000..ee3abe22b31e3 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_ssh_public_keys_operations.py @@ -0,0 +1,487 @@ +# 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, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SshPublicKeysOperations: + """SshPublicKeysOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_subscription( + self, + **kwargs + ) -> AsyncIterable["_models.SshPublicKeysGroupListResult"]: + """Lists all of the SSH public keys in the subscription. Use the nextLink property in the response + to get the next page of SSH public keys. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SshPublicKeysGroupListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.SshPublicKeysGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SshPublicKeysGroupListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["_models.SshPublicKeysGroupListResult"]: + """Lists all of the SSH public keys in the specified resource group. Use the nextLink property in + the response to get the next page of SSH public keys. + + :param resource_group_name: The name of the resource group. + :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 SshPublicKeysGroupListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.SshPublicKeysGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SshPublicKeysGroupListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys'} # type: ignore + + async def create( + self, + resource_group_name: str, + ssh_public_key_name: str, + parameters: "_models.SshPublicKeyResource", + **kwargs + ) -> "_models.SshPublicKeyResource": + """Creates a new SSH public key resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to create the SSH public key. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.SshPublicKeyResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SshPublicKeyResource, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.SshPublicKeyResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeyResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'sshPublicKeyName': self._serialize.url("ssh_public_key_name", ssh_public_key_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SshPublicKeyResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SshPublicKeyResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SshPublicKeyResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + ssh_public_key_name: str, + parameters: "_models.SshPublicKeyUpdateResource", + **kwargs + ) -> "_models.SshPublicKeyResource": + """Updates a new SSH public key resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to update the SSH public key. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.SshPublicKeyUpdateResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SshPublicKeyResource, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.SshPublicKeyResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeyResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'sshPublicKeyName': self._serialize.url("ssh_public_key_name", ssh_public_key_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SshPublicKeyUpdateResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SshPublicKeyResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + ssh_public_key_name: str, + **kwargs + ) -> None: + """Delete an SSH public key. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. + :type ssh_public_key_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 + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'sshPublicKeyName': self._serialize.url("ssh_public_key_name", ssh_public_key_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + ssh_public_key_name: str, + **kwargs + ) -> "_models.SshPublicKeyResource": + """Retrieves information about an SSH public key. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. + :type ssh_public_key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SshPublicKeyResource, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.SshPublicKeyResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeyResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'sshPublicKeyName': self._serialize.url("ssh_public_key_name", ssh_public_key_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SshPublicKeyResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + async def generate_key_pair( + self, + resource_group_name: str, + ssh_public_key_name: str, + **kwargs + ) -> "_models.SshPublicKeyGenerateKeyPairResult": + """Generates and returns a public/private key pair and populates the SSH public key resource with + the public key. The length of the key will be 3072 bits. This operation can only be performed + once per SSH public key resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. + :type ssh_public_key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SshPublicKeyGenerateKeyPairResult, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.SshPublicKeyGenerateKeyPairResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeyGenerateKeyPairResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.generate_key_pair.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'sshPublicKeyName': self._serialize.url("ssh_public_key_name", ssh_public_key_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SshPublicKeyGenerateKeyPairResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + generate_key_pair.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}/generateKeyPair'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_usage_operations.py new file mode 100644 index 0000000000000..06e64807dbd04 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_usage_operations.py @@ -0,0 +1,113 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class UsageOperations: + """UsageOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + location: str, + **kwargs + ) -> AsyncIterable["_models.ListUsagesResult"]: + """Gets, for the specified location, the current compute resource usage information as well as the + limits for compute resources under the subscription. + + :param location: The location for which resource usage is queried. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ListUsagesResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.ListUsagesResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ListUsagesResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_extension_images_operations.py new file mode 100644 index 0000000000000..eb45327eab0f1 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_extension_images_operations.py @@ -0,0 +1,242 @@ +# 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, Generic, List, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class VirtualMachineExtensionImagesOperations: + """VirtualMachineExtensionImagesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + location: str, + publisher_name: str, + type: str, + version: str, + **kwargs + ) -> "_models.VirtualMachineExtensionImage": + """Gets a virtual machine extension image. + + :param location: The name of a supported Azure region. + :type location: str + :param publisher_name: + :type publisher_name: str + :param type: + :type type: str + :param version: + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineExtensionImage, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtensionImage + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtensionImage"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'publisherName': self._serialize.url("publisher_name", publisher_name, 'str'), + 'type': self._serialize.url("type", type, 'str'), + 'version': self._serialize.url("version", version, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineExtensionImage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}'} # type: ignore + + async def list_types( + self, + location: str, + publisher_name: str, + **kwargs + ) -> List["_models.VirtualMachineExtensionImage"]: + """Gets a list of virtual machine extension image types. + + :param location: The name of a supported Azure region. + :type location: str + :param publisher_name: + :type publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VirtualMachineExtensionImage, or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtensionImage] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineExtensionImage"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.list_types.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'publisherName': self._serialize.url("publisher_name", publisher_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineExtensionImage]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_types.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types'} # type: ignore + + async def list_versions( + self, + location: str, + publisher_name: str, + type: str, + filter: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs + ) -> List["_models.VirtualMachineExtensionImage"]: + """Gets a list of virtual machine extension image versions. + + :param location: The name of a supported Azure region. + :type location: str + :param publisher_name: + :type publisher_name: str + :param type: + :type type: str + :param filter: The filter to apply on the operation. + :type filter: str + :param top: + :type top: int + :param orderby: + :type orderby: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VirtualMachineExtensionImage, or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtensionImage] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineExtensionImage"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.list_versions.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'publisherName': self._serialize.url("publisher_name", publisher_name, 'str'), + 'type': self._serialize.url("type", type, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineExtensionImage]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_versions.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_extensions_operations.py new file mode 100644 index 0000000000000..5e3cdfff6ec63 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_extensions_operations.py @@ -0,0 +1,555 @@ +# 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, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class VirtualMachineExtensionsOperations: + """VirtualMachineExtensionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _create_or_update_initial( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs + ) -> "_models.VirtualMachineExtension": + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'vmExtensionName': self._serialize.url("vm_extension_name", vm_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineExtension', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VirtualMachineExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtension", + **kwargs + ) -> AsyncLROPoller["_models.VirtualMachineExtension"]: + """The operation to create or update the extension. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine where the extension should be created or + updated. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. + :type extension_parameters: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtension + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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 VirtualMachineExtension or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + extension_parameters=extension_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualMachineExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'vmExtensionName': self._serialize.url("vm_extension_name", vm_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs + ) -> "_models.VirtualMachineExtension": + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'vmExtensionName': self._serialize.url("vm_extension_name", vm_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineExtensionUpdate", + **kwargs + ) -> AsyncLROPoller["_models.VirtualMachineExtension"]: + """The operation to update the extension. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine where the extension should be updated. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. + :type extension_parameters: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtensionUpdate + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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 VirtualMachineExtension or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + extension_parameters=extension_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualMachineExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'vmExtensionName': self._serialize.url("vm_extension_name", vm_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'vmExtensionName': self._serialize.url("vm_extension_name", vm_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """The operation to delete the extension. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine where the extension should be deleted. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. + :type vm_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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'vmExtensionName': self._serialize.url("vm_extension_name", vm_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + vm_name: str, + vm_extension_name: str, + expand: Optional[str] = None, + **kwargs + ) -> "_models.VirtualMachineExtension": + """The operation to get the extension. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine containing the extension. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. + :type vm_extension_name: str + :param expand: The expand expression to apply on the operation. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineExtension, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtension + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'vmExtensionName': self._serialize.url("vm_extension_name", vm_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + async def list( + self, + resource_group_name: str, + vm_name: str, + expand: Optional[str] = None, + **kwargs + ) -> "_models.VirtualMachineExtensionsListResult": + """The operation to get all extensions of a Virtual Machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine containing the extension. + :type vm_name: str + :param expand: The expand expression to apply on the operation. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineExtensionsListResult, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtensionsListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtensionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineExtensionsListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_images_edge_zone_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_images_edge_zone_operations.py new file mode 100644 index 0000000000000..850c4a766a302 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_images_edge_zone_operations.py @@ -0,0 +1,390 @@ +# 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, Generic, List, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class VirtualMachineImagesEdgeZoneOperations: + """VirtualMachineImagesEdgeZoneOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + location: str, + edge_zone: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + **kwargs + ) -> "_models.VirtualMachineImage": + """Gets a virtual machine image in an edge zone. + + :param location: The name of a supported Azure region. + :type location: str + :param edge_zone: The name of the edge zone. + :type edge_zone: str + :param publisher_name: A valid image publisher. + :type publisher_name: str + :param offer: A valid image publisher offer. + :type offer: str + :param skus: A valid image SKU. + :type skus: str + :param version: A valid image SKU version. + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineImage, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineImage + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineImage"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'edgeZone': self._serialize.url("edge_zone", edge_zone, 'str'), + 'publisherName': self._serialize.url("publisher_name", publisher_name, 'str'), + 'offer': self._serialize.url("offer", offer, 'str'), + 'skus': self._serialize.url("skus", skus, 'str'), + 'version': self._serialize.url("version", version, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineImage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}'} # type: ignore + + async def list( + self, + location: str, + edge_zone: str, + publisher_name: str, + offer: str, + skus: str, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs + ) -> List["_models.VirtualMachineImageResource"]: + """Gets a list of all virtual machine image versions for the specified location, edge zone, + publisher, offer, and SKU. + + :param location: The name of a supported Azure region. + :type location: str + :param edge_zone: The name of the edge zone. + :type edge_zone: str + :param publisher_name: A valid image publisher. + :type publisher_name: str + :param offer: A valid image publisher offer. + :type offer: str + :param skus: A valid image SKU. + :type skus: str + :param expand: The expand expression to apply on the operation. + :type expand: str + :param top: An integer value specifying the number of images to return that matches supplied + values. + :type top: int + :param orderby: Specifies the order of the results returned. Formatted as an OData query. + :type orderby: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VirtualMachineImageResource, or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineImageResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineImageResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'edgeZone': self._serialize.url("edge_zone", edge_zone, 'str'), + 'publisherName': self._serialize.url("publisher_name", publisher_name, 'str'), + 'offer': self._serialize.url("offer", offer, 'str'), + 'skus': self._serialize.url("skus", skus, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineImageResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions'} # type: ignore + + async def list_offers( + self, + location: str, + edge_zone: str, + publisher_name: str, + **kwargs + ) -> List["_models.VirtualMachineImageResource"]: + """Gets a list of virtual machine image offers for the specified location, edge zone and + publisher. + + :param location: The name of a supported Azure region. + :type location: str + :param edge_zone: The name of the edge zone. + :type edge_zone: str + :param publisher_name: A valid image publisher. + :type publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VirtualMachineImageResource, or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineImageResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineImageResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.list_offers.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'edgeZone': self._serialize.url("edge_zone", edge_zone, 'str'), + 'publisherName': self._serialize.url("publisher_name", publisher_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineImageResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_offers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers'} # type: ignore + + async def list_publishers( + self, + location: str, + edge_zone: str, + **kwargs + ) -> List["_models.VirtualMachineImageResource"]: + """Gets a list of virtual machine image publishers for the specified Azure location and edge zone. + + :param location: The name of a supported Azure region. + :type location: str + :param edge_zone: The name of the edge zone. + :type edge_zone: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VirtualMachineImageResource, or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineImageResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineImageResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.list_publishers.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'edgeZone': self._serialize.url("edge_zone", edge_zone, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineImageResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers'} # type: ignore + + async def list_skus( + self, + location: str, + edge_zone: str, + publisher_name: str, + offer: str, + **kwargs + ) -> List["_models.VirtualMachineImageResource"]: + """Gets a list of virtual machine image SKUs for the specified location, edge zone, publisher, and + offer. + + :param location: The name of a supported Azure region. + :type location: str + :param edge_zone: The name of the edge zone. + :type edge_zone: str + :param publisher_name: A valid image publisher. + :type publisher_name: str + :param offer: A valid image publisher offer. + :type offer: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VirtualMachineImageResource, or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineImageResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineImageResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.list_skus.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'edgeZone': self._serialize.url("edge_zone", edge_zone, 'str'), + 'publisherName': self._serialize.url("publisher_name", publisher_name, 'str'), + 'offer': self._serialize.url("offer", offer, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineImageResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_skus.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_images_operations.py new file mode 100644 index 0000000000000..454512afbb00f --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_images_operations.py @@ -0,0 +1,367 @@ +# 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, Generic, List, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class VirtualMachineImagesOperations: + """VirtualMachineImagesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + location: str, + publisher_name: str, + offer: str, + skus: str, + version: str, + **kwargs + ) -> "_models.VirtualMachineImage": + """Gets a virtual machine image. + + :param location: The name of a supported Azure region. + :type location: str + :param publisher_name: A valid image publisher. + :type publisher_name: str + :param offer: A valid image publisher offer. + :type offer: str + :param skus: A valid image SKU. + :type skus: str + :param version: A valid image SKU version. + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineImage, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineImage + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineImage"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'publisherName': self._serialize.url("publisher_name", publisher_name, 'str'), + 'offer': self._serialize.url("offer", offer, 'str'), + 'skus': self._serialize.url("skus", skus, 'str'), + 'version': self._serialize.url("version", version, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineImage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}'} # type: ignore + + async def list( + self, + location: str, + publisher_name: str, + offer: str, + skus: str, + expand: Optional[str] = None, + top: Optional[int] = None, + orderby: Optional[str] = None, + **kwargs + ) -> List["_models.VirtualMachineImageResource"]: + """Gets a list of all virtual machine image versions for the specified location, publisher, offer, + and SKU. + + :param location: The name of a supported Azure region. + :type location: str + :param publisher_name: A valid image publisher. + :type publisher_name: str + :param offer: A valid image publisher offer. + :type offer: str + :param skus: A valid image SKU. + :type skus: str + :param expand: The expand expression to apply on the operation. + :type expand: str + :param top: + :type top: int + :param orderby: + :type orderby: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VirtualMachineImageResource, or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineImageResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineImageResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'publisherName': self._serialize.url("publisher_name", publisher_name, 'str'), + 'offer': self._serialize.url("offer", offer, 'str'), + 'skus': self._serialize.url("skus", skus, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineImageResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions'} # type: ignore + + async def list_offers( + self, + location: str, + publisher_name: str, + **kwargs + ) -> List["_models.VirtualMachineImageResource"]: + """Gets a list of virtual machine image offers for the specified location and publisher. + + :param location: The name of a supported Azure region. + :type location: str + :param publisher_name: A valid image publisher. + :type publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VirtualMachineImageResource, or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineImageResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineImageResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.list_offers.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'publisherName': self._serialize.url("publisher_name", publisher_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineImageResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_offers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers'} # type: ignore + + async def list_publishers( + self, + location: str, + **kwargs + ) -> List["_models.VirtualMachineImageResource"]: + """Gets a list of virtual machine image publishers for the specified Azure location. + + :param location: The name of a supported Azure region. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VirtualMachineImageResource, or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineImageResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineImageResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.list_publishers.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineImageResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers'} # type: ignore + + async def list_skus( + self, + location: str, + publisher_name: str, + offer: str, + **kwargs + ) -> List["_models.VirtualMachineImageResource"]: + """Gets a list of virtual machine image SKUs for the specified location, publisher, and offer. + + :param location: The name of a supported Azure region. + :type location: str + :param publisher_name: A valid image publisher. + :type publisher_name: str + :param offer: A valid image publisher offer. + :type offer: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VirtualMachineImageResource, or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineImageResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineImageResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.list_skus.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'publisherName': self._serialize.url("publisher_name", publisher_name, 'str'), + 'offer': self._serialize.url("offer", offer, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineImageResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_skus.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_run_commands_operations.py new file mode 100644 index 0000000000000..42fd2953951ce --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_run_commands_operations.py @@ -0,0 +1,700 @@ +# 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, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class VirtualMachineRunCommandsOperations: + """VirtualMachineRunCommandsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + location: str, + **kwargs + ) -> AsyncIterable["_models.RunCommandListResult"]: + """Lists all available run commands for a subscription in a location. + + :param location: The location upon which run commands is queried. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RunCommandListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.RunCommandListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json, text/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('RunCommandListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands'} # type: ignore + + async def get( + self, + location: str, + command_id: str, + **kwargs + ) -> "_models.RunCommandDocument": + """Gets specific run command for a subscription in a location. + + :param location: The location upon which run commands is queried. + :type location: str + :param command_id: The command id. + :type command_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RunCommandDocument, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.RunCommandDocument + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandDocument"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json, text/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + 'commandId': self._serialize.url("command_id", command_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RunCommandDocument', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommand", + **kwargs + ) -> "_models.VirtualMachineRunCommand": + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json, text/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'runCommandName': self._serialize.url("run_command_name", run_command_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(run_command, 'VirtualMachineRunCommand') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommand", + **kwargs + ) -> AsyncLROPoller["_models.VirtualMachineRunCommand"]: + """The operation to create or update the run command. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine where the run command should be created or + updated. + :type vm_name: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_name: str + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + :type run_command: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommand + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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 VirtualMachineRunCommand or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommand] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + run_command=run_command, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'runCommandName': self._serialize.url("run_command_name", run_command_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommandUpdate", + **kwargs + ) -> "_models.VirtualMachineRunCommand": + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json, text/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'runCommandName': self._serialize.url("run_command_name", run_command_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommandUpdate", + **kwargs + ) -> AsyncLROPoller["_models.VirtualMachineRunCommand"]: + """The operation to update the run command. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine where the run command should be updated. + :type vm_name: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_name: str + :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. + :type run_command: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommandUpdate + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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 VirtualMachineRunCommand or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommand] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + run_command=run_command, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'runCommandName': self._serialize.url("run_command_name", run_command_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json, text/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'runCommandName': self._serialize.url("run_command_name", run_command_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """The operation to delete the run command. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine where the run command should be deleted. + :type vm_name: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'runCommandName': self._serialize.url("run_command_name", run_command_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + + async def get_by_virtual_machine( + self, + resource_group_name: str, + vm_name: str, + run_command_name: str, + expand: Optional[str] = None, + **kwargs + ) -> "_models.VirtualMachineRunCommand": + """The operation to get the run command. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine containing the run command. + :type vm_name: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_name: str + :param expand: The expand expression to apply on the operation. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineRunCommand, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommand + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json, text/json" + + # Construct URL + url = self.get_by_virtual_machine.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'runCommandName': self._serialize.url("run_command_name", run_command_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_by_virtual_machine.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + + def list_by_virtual_machine( + self, + resource_group_name: str, + vm_name: str, + expand: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.VirtualMachineRunCommandsListResult"]: + """The operation to get all run commands of a Virtual Machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine containing the run command. + :type vm_name: str + :param expand: The expand expression to apply on the operation. + :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 VirtualMachineRunCommandsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommandsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json, text/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_virtual_machine.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('VirtualMachineRunCommandsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_virtual_machine.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py new file mode 100644 index 0000000000000..d5ec07a2914a0 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_extensions_operations.py @@ -0,0 +1,571 @@ +# 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, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class VirtualMachineScaleSetExtensionsOperations: + """VirtualMachineScaleSetExtensionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _create_or_update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtension", + **kwargs + ) -> "_models.VirtualMachineScaleSetExtension": + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'vmssExtensionName': self._serialize.url("vmss_extension_name", vmss_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineScaleSetExtension', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VirtualMachineScaleSetExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtension", + **kwargs + ) -> AsyncLROPoller["_models.VirtualMachineScaleSetExtension"]: + """The operation to create or update an extension. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set where the extension should be create or + updated. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. + :type vmss_extension_name: str + :param extension_parameters: Parameters supplied to the Create VM scale set Extension + operation. + :type extension_parameters: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetExtension + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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 VirtualMachineScaleSetExtension or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + extension_parameters=extension_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualMachineScaleSetExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'vmssExtensionName': self._serialize.url("vmss_extension_name", vmss_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtensionUpdate", + **kwargs + ) -> "_models.VirtualMachineScaleSetExtension": + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'vmssExtensionName': self._serialize.url("vmss_extension_name", vmss_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtensionUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineScaleSetExtension', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VirtualMachineScaleSetExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetExtensionUpdate", + **kwargs + ) -> AsyncLROPoller["_models.VirtualMachineScaleSetExtension"]: + """The operation to update an extension. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set where the extension should be updated. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. + :type vmss_extension_name: str + :param extension_parameters: Parameters supplied to the Update VM scale set Extension + operation. + :type extension_parameters: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetExtensionUpdate + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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 VirtualMachineScaleSetExtension or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + extension_parameters=extension_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualMachineScaleSetExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'vmssExtensionName': self._serialize.url("vmss_extension_name", vmss_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'vmssExtensionName': self._serialize.url("vmss_extension_name", vmss_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """The operation to delete the extension. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set where the extension should be deleted. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. + :type vmss_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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'vmssExtensionName': self._serialize.url("vmss_extension_name", vmss_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + vm_scale_set_name: str, + vmss_extension_name: str, + expand: Optional[str] = None, + **kwargs + ) -> "_models.VirtualMachineScaleSetExtension": + """The operation to get the extension. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set containing the extension. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. + :type vmss_extension_name: str + :param expand: The expand expression to apply on the operation. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineScaleSetExtension, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetExtension + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'vmssExtensionName': self._serialize.url("vmss_extension_name", vmss_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineScaleSetExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + def list( + self, + resource_group_name: str, + vm_scale_set_name: str, + **kwargs + ) -> AsyncIterable["_models.VirtualMachineScaleSetExtensionListResult"]: + """Gets a list of all extensions in a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set containing the extension. + :type vm_scale_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineScaleSetExtensionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetExtensionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('VirtualMachineScaleSetExtensionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py new file mode 100644 index 0000000000000..624abdcac09d7 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -0,0 +1,423 @@ +# 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, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class VirtualMachineScaleSetRollingUpgradesOperations: + """VirtualMachineScaleSetRollingUpgradesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _cancel_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._cancel_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel'} # type: ignore + + async def begin_cancel( + self, + resource_group_name: str, + vm_scale_set_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Cancels the current virtual machine scale set rolling upgrade. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._cancel_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_cancel.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel'} # type: ignore + + async def _start_os_upgrade_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._start_os_upgrade_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_os_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade'} # type: ignore + + async def begin_start_os_upgrade( + self, + resource_group_name: str, + vm_scale_set_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Starts a rolling upgrade to move all virtual machine scale set instances to the latest + available Platform Image OS version. Instances which are already running the latest available + OS version are not affected. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._start_os_upgrade_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start_os_upgrade.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade'} # type: ignore + + async def _start_extension_upgrade_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._start_extension_upgrade_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_extension_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade'} # type: ignore + + async def begin_start_extension_upgrade( + self, + resource_group_name: str, + vm_scale_set_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to + the latest available extension version. Instances which are already running the latest + extension versions are not affected. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._start_extension_upgrade_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start_extension_upgrade.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade'} # type: ignore + + async def get_latest( + self, + resource_group_name: str, + vm_scale_set_name: str, + **kwargs + ) -> "_models.RollingUpgradeStatusInfo": + """Gets the status of the latest virtual machine scale set rolling upgrade. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RollingUpgradeStatusInfo, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.RollingUpgradeStatusInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RollingUpgradeStatusInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get_latest.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RollingUpgradeStatusInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_latest.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py new file mode 100644 index 0000000000000..e7bde312ee438 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_vm_extensions_operations.py @@ -0,0 +1,585 @@ +# 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, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class VirtualMachineScaleSetVMExtensionsOperations: + """VirtualMachineScaleSetVMExtensionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _create_or_update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetVMExtension", + **kwargs + ) -> "_models.VirtualMachineScaleSetVMExtension": + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'vmExtensionName': self._serialize.url("vm_extension_name", vm_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtension') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineScaleSetVMExtension', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VirtualMachineScaleSetVMExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetVMExtension", + **kwargs + ) -> AsyncLROPoller["_models.VirtualMachineScaleSetVMExtension"]: + """The operation to create or update the VMSS VM extension. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. + :type extension_parameters: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMExtension + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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 VirtualMachineScaleSetVMExtension or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, + extension_parameters=extension_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualMachineScaleSetVMExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'vmExtensionName': self._serialize.url("vm_extension_name", vm_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetVMExtensionUpdate", + **kwargs + ) -> "_models.VirtualMachineScaleSetVMExtension": + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'vmExtensionName': self._serialize.url("vm_extension_name", vm_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtensionUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineScaleSetVMExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + extension_parameters: "_models.VirtualMachineScaleSetVMExtensionUpdate", + **kwargs + ) -> AsyncLROPoller["_models.VirtualMachineScaleSetVMExtension"]: + """The operation to update the VMSS VM extension. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. + :type extension_parameters: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMExtensionUpdate + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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 VirtualMachineScaleSetVMExtension or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, + extension_parameters=extension_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualMachineScaleSetVMExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'vmExtensionName': self._serialize.url("vm_extension_name", vm_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'vmExtensionName': self._serialize.url("vm_extension_name", vm_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """The operation to delete the VMSS VM extension. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. + :type vm_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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'vmExtensionName': self._serialize.url("vm_extension_name", vm_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_extension_name: str, + expand: Optional[str] = None, + **kwargs + ) -> "_models.VirtualMachineScaleSetVMExtension": + """The operation to get the VMSS VM extension. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. + :type vm_extension_name: str + :param expand: The expand expression to apply on the operation. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineScaleSetVMExtension, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMExtension + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'vmExtensionName': self._serialize.url("vm_extension_name", vm_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineScaleSetVMExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}'} # type: ignore + + async def list( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + expand: Optional[str] = None, + **kwargs + ) -> "_models.VirtualMachineScaleSetVMExtensionsListResult": + """The operation to get all extensions of an instance in Virtual Machine Scaleset. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param expand: The expand expression to apply on the operation. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineScaleSetVMExtensionsListResult, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMExtensionsListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtensionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineScaleSetVMExtensionsListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py new file mode 100644 index 0000000000000..caa777a562ea9 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_vm_run_commands_operations.py @@ -0,0 +1,600 @@ +# 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, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class VirtualMachineScaleSetVMRunCommandsOperations: + """VirtualMachineScaleSetVMRunCommandsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _create_or_update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommand", + **kwargs + ) -> "_models.VirtualMachineRunCommand": + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json, text/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'runCommandName': self._serialize.url("run_command_name", run_command_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(run_command, 'VirtualMachineRunCommand') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommand", + **kwargs + ) -> AsyncLROPoller["_models.VirtualMachineRunCommand"]: + """The operation to create or update the VMSS VM run command. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_name: str + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + :type run_command: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommand + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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 VirtualMachineRunCommand or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommand] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, + run_command=run_command, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'runCommandName': self._serialize.url("run_command_name", run_command_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommandUpdate", + **kwargs + ) -> "_models.VirtualMachineRunCommand": + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json, text/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'runCommandName': self._serialize.url("run_command_name", run_command_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + run_command: "_models.VirtualMachineRunCommandUpdate", + **kwargs + ) -> AsyncLROPoller["_models.VirtualMachineRunCommand"]: + """The operation to update the VMSS VM run command. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_name: str + :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. + :type run_command: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommandUpdate + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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 VirtualMachineRunCommand or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommand] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, + run_command=run_command, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'runCommandName': self._serialize.url("run_command_name", run_command_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json, text/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'runCommandName': self._serialize.url("run_command_name", run_command_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """The operation to delete the VMSS VM run command. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'runCommandName': self._serialize.url("run_command_name", run_command_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + run_command_name: str, + expand: Optional[str] = None, + **kwargs + ) -> "_models.VirtualMachineRunCommand": + """The operation to get the VMSS VM run command. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_name: str + :param expand: The expand expression to apply on the operation. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineRunCommand, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommand + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json, text/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'runCommandName': self._serialize.url("run_command_name", run_command_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}'} # type: ignore + + def list( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + expand: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.VirtualMachineRunCommandsListResult"]: + """The operation to get all run commands of an instance in Virtual Machine Scaleset. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param expand: The expand expression to apply on the operation. + :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 VirtualMachineRunCommandsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommandsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json, text/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('VirtualMachineRunCommandsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_vms_operations.py new file mode 100644 index 0000000000000..d38bb4eaf9d0c --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_set_vms_operations.py @@ -0,0 +1,1714 @@ +# 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, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class VirtualMachineScaleSetVMsOperations: + """VirtualMachineScaleSetVMsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _reimage_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional["_models.VirtualMachineScaleSetVMReimageParameters"] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._reimage_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if vm_scale_set_vm_reimage_input is not None: + body_content = self._serialize.body(vm_scale_set_vm_reimage_input, 'VirtualMachineScaleSetVMReimageParameters') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + + async def begin_reimage( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + vm_scale_set_vm_reimage_input: Optional["_models.VirtualMachineScaleSetVMReimageParameters"] = None, + **kwargs + ) -> AsyncLROPoller[None]: + """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param vm_scale_set_vm_reimage_input: Parameters for the Reimaging Virtual machine in ScaleSet. + :type vm_scale_set_vm_reimage_input: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMReimageParameters + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._reimage_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_scale_set_vm_reimage_input=vm_scale_set_vm_reimage_input, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + + async def _reimage_all_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._reimage_all_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall'} # type: ignore + + async def begin_reimage_all( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. + This operation is only supported for managed disks. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: 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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._reimage_all_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_reimage_all.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall'} # type: ignore + + async def _deallocate_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._deallocate_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + + async def begin_deallocate( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and + releases the compute resources it uses. You are not billed for the compute resources of this + virtual machine once it is deallocated. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: 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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._deallocate_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_deallocate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.VirtualMachineScaleSetVM", + **kwargs + ) -> "_models.VirtualMachineScaleSetVM": + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineScaleSetVM', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('VirtualMachineScaleSetVM', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.VirtualMachineScaleSetVM", + **kwargs + ) -> AsyncLROPoller["_models.VirtualMachineScaleSetVM"]: + """Updates a virtual machine of a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set where the extension should be create or + updated. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVM + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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 VirtualMachineScaleSetVM or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVM] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualMachineScaleSetVM', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + force_deletion: Optional[bool] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if force_deletion is not None: + query_parameters['forceDeletion'] = self._serialize.query("force_deletion", force_deletion, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + force_deletion: Optional[bool] = None, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a virtual machine from a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param force_deletion: Optional parameter to force delete a virtual machine from a VM scale + set. (Feature in Preview). + :type force_deletion: 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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + force_deletion=force_deletion, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + async def get( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, + **kwargs + ) -> "_models.VirtualMachineScaleSetVM": + """Gets a virtual machine from a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param expand: The expand expression to apply on the operation. + :type expand: str or ~azure.mgmt.compute.v2021_03_01.models.InstanceViewTypes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineScaleSetVM, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVM + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineScaleSetVM', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + async def get_instance_view( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs + ) -> "_models.VirtualMachineScaleSetVMInstanceView": + """Gets the status of a virtual machine from a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineScaleSetVMInstanceView, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMInstanceView + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMInstanceView"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get_instance_view.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineScaleSetVMInstanceView', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView'} # type: ignore + + def list( + self, + resource_group_name: str, + virtual_machine_scale_set_name: str, + filter: Optional[str] = None, + select: Optional[str] = None, + expand: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.VirtualMachineScaleSetVMListResult"]: + """Gets a list of all virtual machines in a VM scale sets. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_machine_scale_set_name: The name of the VM scale set. + :type virtual_machine_scale_set_name: str + :param filter: The filter to apply to the operation. Allowed values are + 'startswith(instanceView/statuses/code, 'PowerState') eq true', 'properties/latestModelApplied + eq true', 'properties/latestModelApplied eq false'. + :type filter: str + :param select: The list parameters. Allowed values are 'instanceView', 'instanceView/statuses'. + :type select: str + :param expand: The expand expression to apply to the operation. Allowed values are + 'instanceView'. + :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 VirtualMachineScaleSetVMListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'virtualMachineScaleSetName': self._serialize.url("virtual_machine_scale_set_name", virtual_machine_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if select is not None: + query_parameters['$select'] = self._serialize.query("select", select, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('VirtualMachineScaleSetVMListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines'} # type: ignore + + async def _power_off_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + skip_shutdown: Optional[bool] = False, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._power_off_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if skip_shutdown is not None: + query_parameters['skipShutdown'] = self._serialize.query("skip_shutdown", skip_shutdown, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + + async def begin_power_off( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + skip_shutdown: Optional[bool] = False, + **kwargs + ) -> AsyncLROPoller[None]: + """Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached + and you are getting charged for the resources. Instead, use deallocate to release resources and + avoid charges. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this + flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this + flag is false if not specified. + :type skip_shutdown: 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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._power_off_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + skip_shutdown=skip_shutdown, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_power_off.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + + async def _restart_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._restart_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + + async def begin_restart( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Restarts a virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: 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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._restart_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + + async def _start_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._start_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + + async def begin_start( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Starts a virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: 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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._start_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + + async def _redeploy_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._redeploy_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy'} # type: ignore + + async def begin_redeploy( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and + powers it back on. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: 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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._redeploy_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_redeploy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy'} # type: ignore + + async def retrieve_boot_diagnostics_data( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + sas_uri_expiration_time_in_minutes: Optional[int] = None, + **kwargs + ) -> "_models.RetrieveBootDiagnosticsDataResult": + """The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale + set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param sas_uri_expiration_time_in_minutes: Expiration duration in minutes for the SAS URIs with + a value between 1 to 1440 minutes. :code:`
`:code:`
`NOTE: If not specified, SAS URIs + will be generated with a default expiration duration of 120 minutes. + :type sas_uri_expiration_time_in_minutes: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RetrieveBootDiagnosticsDataResult, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.RetrieveBootDiagnosticsDataResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RetrieveBootDiagnosticsDataResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.retrieve_boot_diagnostics_data.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if sas_uri_expiration_time_in_minutes is not None: + query_parameters['sasUriExpirationTimeInMinutes'] = self._serialize.query("sas_uri_expiration_time_in_minutes", sas_uri_expiration_time_in_minutes, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RetrieveBootDiagnosticsDataResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + retrieve_boot_diagnostics_data.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData'} # type: ignore + + async def _perform_maintenance_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._perform_maintenance_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance'} # type: ignore + + async def begin_perform_maintenance( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Performs maintenance on a virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: 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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._perform_maintenance_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_perform_maintenance.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance'} # type: ignore + + async def simulate_eviction( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + **kwargs + ) -> None: + """The operation to simulate the eviction of spot virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: 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 + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self.simulate_eviction.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + simulate_eviction.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/simulateEviction'} # type: ignore + + async def _run_command_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.RunCommandInput", + **kwargs + ) -> Optional["_models.RunCommandResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json, text/json" + + # Construct URL + url = self._run_command_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RunCommandInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RunCommandResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _run_command_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand'} # type: ignore + + async def begin_run_command( + self, + resource_group_name: str, + vm_scale_set_name: str, + instance_id: str, + parameters: "_models.RunCommandInput", + **kwargs + ) -> AsyncLROPoller["_models.RunCommandResult"]: + """Run command on a virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param parameters: Parameters supplied to the Run command operation. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.RunCommandInput + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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 RunCommandResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._run_command_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('RunCommandResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_run_command.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_sets_operations.py new file mode 100644 index 0000000000000..ff9a2e2638ccf --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_scale_sets_operations.py @@ -0,0 +1,2340 @@ +# 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, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class VirtualMachineScaleSetsOperations: + """VirtualMachineScaleSetsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_location( + self, + location: str, + **kwargs + ) -> AsyncIterable["_models.VirtualMachineScaleSetListResult"]: + """Gets all the VM scale sets under the specified subscription for the specified location. + + :param location: The location for which VM scale sets under the subscription are queried. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_location.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_location.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachineScaleSets'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSet", + **kwargs + ) -> "_models.VirtualMachineScaleSet": + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VirtualMachineScaleSet') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineScaleSet', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VirtualMachineScaleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSet", + **kwargs + ) -> AsyncLROPoller["_models.VirtualMachineScaleSet"]: + """Create or update a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set to create or update. + :type vm_scale_set_name: str + :param parameters: The scale set object. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSet + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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 VirtualMachineScaleSet or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualMachineScaleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSetUpdate", + **kwargs + ) -> "_models.VirtualMachineScaleSet": + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineScaleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VirtualMachineScaleSetUpdate", + **kwargs + ) -> AsyncLROPoller["_models.VirtualMachineScaleSet"]: + """Update a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set to create or update. + :type vm_scale_set_name: str + :param parameters: The scale set object. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetUpdate + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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 VirtualMachineScaleSet or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualMachineScaleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + force_deletion: Optional[bool] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if force_deletion is not None: + query_parameters['forceDeletion'] = self._serialize.query("force_deletion", force_deletion, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + vm_scale_set_name: str, + force_deletion: Optional[bool] = None, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param force_deletion: Optional parameter to force delete a VM scale set. (Feature in Preview). + :type force_deletion: 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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + force_deletion=force_deletion, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + vm_scale_set_name: str, + expand: Optional[Union[str, "_models.ExpandTypesForGetVMScaleSets"]] = None, + **kwargs + ) -> "_models.VirtualMachineScaleSet": + """Display information about a virtual machine scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param expand: The expand expression to apply on the operation. + :type expand: str or ~azure.mgmt.compute.v2021_03_01.models.ExpandTypesForGetVMScaleSets + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineScaleSet, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineScaleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + async def _deallocate_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._deallocate_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if vm_instance_i_ds is not None: + body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + + async def begin_deallocate( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs + ) -> AsyncLROPoller[None]: + """Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and + releases the compute resources. You are not billed for the compute resources that this virtual + machine scale set deallocates. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :type vm_instance_i_ds: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._deallocate_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_deallocate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + + async def _delete_instances_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + force_deletion: Optional[bool] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._delete_instances_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if force_deletion is not None: + query_parameters['forceDeletion'] = self._serialize.query("force_deletion", force_deletion, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + + async def begin_delete_instances( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + force_deletion: Optional[bool] = None, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :type vm_instance_i_ds: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :param force_deletion: Optional parameter to force delete virtual machines from the VM scale + set. (Feature in Preview). + :type force_deletion: 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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_instances_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + force_deletion=force_deletion, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_instances.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + + async def get_instance_view( + self, + resource_group_name: str, + vm_scale_set_name: str, + **kwargs + ) -> "_models.VirtualMachineScaleSetInstanceView": + """Gets the status of a VM scale set instance. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineScaleSetInstanceView, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetInstanceView + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetInstanceView"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get_instance_view.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineScaleSetInstanceView', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView'} # type: ignore + + def list( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["_models.VirtualMachineScaleSetListResult"]: + """Gets a list of all VM scale sets under a resource group. + + :param resource_group_name: The name of the resource group. + :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 VirtualMachineScaleSetListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + + def list_all( + self, + **kwargs + ) -> AsyncIterable["_models.VirtualMachineScaleSetListWithLinkResult"]: + """Gets a list of all VM Scale Sets in the subscription, regardless of the associated resource + group. Use nextLink property in the response to get the next page of VM Scale Sets. Do this + till nextLink is null to fetch all the VM Scale Sets. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineScaleSetListWithLinkResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetListWithLinkResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_all.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('VirtualMachineScaleSetListWithLinkResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + + def list_skus( + self, + resource_group_name: str, + vm_scale_set_name: str, + **kwargs + ) -> AsyncIterable["_models.VirtualMachineScaleSetListSkusResult"]: + """Gets a list of SKUs available for your VM scale set, including the minimum and maximum VM + instances allowed for each SKU. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineScaleSetListSkusResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetListSkusResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_skus.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('VirtualMachineScaleSetListSkusResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus'} # type: ignore + + def get_os_upgrade_history( + self, + resource_group_name: str, + vm_scale_set_name: str, + **kwargs + ) -> AsyncIterable["_models.VirtualMachineScaleSetListOSUpgradeHistory"]: + """Gets list of OS upgrades on a VM scale set instance. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineScaleSetListOSUpgradeHistory or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetListOSUpgradeHistory] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.get_os_upgrade_history.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('VirtualMachineScaleSetListOSUpgradeHistory', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + get_os_upgrade_history.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory'} # type: ignore + + async def _power_off_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + skip_shutdown: Optional[bool] = False, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._power_off_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if skip_shutdown is not None: + query_parameters['skipShutdown'] = self._serialize.query("skip_shutdown", skip_shutdown, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if vm_instance_i_ds is not None: + body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + + async def begin_power_off( + self, + resource_group_name: str, + vm_scale_set_name: str, + skip_shutdown: Optional[bool] = False, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs + ) -> AsyncLROPoller[None]: + """Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still + attached and you are getting charged for the resources. Instead, use deallocate to release + resources and avoid charges. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this + flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this + flag is false if not specified. + :type skip_shutdown: bool + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :type vm_instance_i_ds: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._power_off_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + skip_shutdown=skip_shutdown, + vm_instance_i_ds=vm_instance_i_ds, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_power_off.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + + async def _restart_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._restart_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if vm_instance_i_ds is not None: + body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + + async def begin_restart( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs + ) -> AsyncLROPoller[None]: + """Restarts one or more virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :type vm_instance_i_ds: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._restart_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + + async def _start_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._start_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if vm_instance_i_ds is not None: + body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + + async def begin_start( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs + ) -> AsyncLROPoller[None]: + """Starts one or more virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :type vm_instance_i_ds: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._start_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + + async def _redeploy_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._redeploy_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if vm_instance_i_ds is not None: + body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy'} # type: ignore + + async def begin_redeploy( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs + ) -> AsyncLROPoller[None]: + """Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, + and powers them back on. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :type vm_instance_i_ds: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._redeploy_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_redeploy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy'} # type: ignore + + async def _perform_maintenance_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._perform_maintenance_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if vm_instance_i_ds is not None: + body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance'} # type: ignore + + async def begin_perform_maintenance( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs + ) -> AsyncLROPoller[None]: + """Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances + which are not eligible for perform maintenance will be failed. Please refer to best practices + for more details: https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual- + machine-scale-sets-maintenance-notifications. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :type vm_instance_i_ds: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._perform_maintenance_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_perform_maintenance.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance'} # type: ignore + + async def _update_instances_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._update_instances_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _update_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + + async def begin_update_instances( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs", + **kwargs + ) -> AsyncLROPoller[None]: + """Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :type vm_instance_i_ds: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_instances_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_instances.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + + async def _reimage_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional["_models.VirtualMachineScaleSetReimageParameters"] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._reimage_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if vm_scale_set_reimage_input is not None: + body_content = self._serialize.body(vm_scale_set_reimage_input, 'VirtualMachineScaleSetReimageParameters') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + + async def begin_reimage( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_scale_set_reimage_input: Optional["_models.VirtualMachineScaleSetReimageParameters"] = None, + **kwargs + ) -> AsyncLROPoller[None]: + """Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which + don't have a ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual + machine is reset to initial state. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. + :type vm_scale_set_reimage_input: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetReimageParameters + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._reimage_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_scale_set_reimage_input=vm_scale_set_reimage_input, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + + async def _reimage_all_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._reimage_all_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if vm_instance_i_ds is not None: + body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall'} # type: ignore + + async def begin_reimage_all( + self, + resource_group_name: str, + vm_scale_set_name: str, + vm_instance_i_ds: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] = None, + **kwargs + ) -> AsyncLROPoller[None]: + """Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This + operation is only supported for managed disks. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :type vm_instance_i_ds: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._reimage_all_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_reimage_all.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall'} # type: ignore + + async def force_recovery_service_fabric_platform_update_domain_walk( + self, + resource_group_name: str, + vm_scale_set_name: str, + platform_update_domain: int, + **kwargs + ) -> "_models.RecoveryWalkResponse": + """Manual platform update domain walk to update virtual machines in a service fabric virtual + machine scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param platform_update_domain: The platform update domain for which a manual recovery walk is + requested. + :type platform_update_domain: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RecoveryWalkResponse, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.RecoveryWalkResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryWalkResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.force_recovery_service_fabric_platform_update_domain_walk.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['platformUpdateDomain'] = self._serialize.query("platform_update_domain", platform_update_domain, 'int') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RecoveryWalkResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk'} # type: ignore + + async def convert_to_single_placement_group( + self, + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.VMScaleSetConvertToSinglePlacementGroupInput", + **kwargs + ) -> None: + """Converts SinglePlacementGroup property to false for a existing virtual machine scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the virtual machine scale set to create or update. + :type vm_scale_set_name: str + :param parameters: The input object for ConvertToSinglePlacementGroup API. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.VMScaleSetConvertToSinglePlacementGroupInput + :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 + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.convert_to_single_placement_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VMScaleSetConvertToSinglePlacementGroupInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + convert_to_single_placement_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup'} # type: ignore + + async def _set_orchestration_service_state_initial( + self, + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.OrchestrationServiceStateInput", + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._set_orchestration_service_state_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'OrchestrationServiceStateInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _set_orchestration_service_state_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState'} # type: ignore + + async def begin_set_orchestration_service_state( + self, + resource_group_name: str, + vm_scale_set_name: str, + parameters: "_models.OrchestrationServiceStateInput", + **kwargs + ) -> AsyncLROPoller[None]: + """Changes ServiceState property for a given service. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the virtual machine scale set to create or update. + :type vm_scale_set_name: str + :param parameters: The input object for SetOrchestrationServiceState API. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.OrchestrationServiceStateInput + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._set_orchestration_service_state_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_set_orchestration_service_state.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_sizes_operations.py new file mode 100644 index 0000000000000..7bd6e43b23517 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machine_sizes_operations.py @@ -0,0 +1,113 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class VirtualMachineSizesOperations: + """VirtualMachineSizesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + location: str, + **kwargs + ) -> AsyncIterable["_models.VirtualMachineSizeListResult"]: + """This API is deprecated. Use `Resources Skus `_. + + :param location: The location upon which virtual-machine-sizes is queried. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineSizeListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machines_operations.py new file mode 100644 index 0000000000000..82c2cfac916a7 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/aio/operations/_virtual_machines_operations.py @@ -0,0 +1,2473 @@ +# 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, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class VirtualMachinesOperations: + """VirtualMachinesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_location( + self, + location: str, + **kwargs + ) -> AsyncIterable["_models.VirtualMachineListResult"]: + """Gets all the virtual machines under the specified subscription for the specified location. + + :param location: The location for which virtual machines under the subscription are queried. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_location.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_location.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines'} # type: ignore + + async def _capture_initial( + self, + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineCaptureParameters", + **kwargs + ) -> Optional["_models.VirtualMachineCaptureResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.VirtualMachineCaptureResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._capture_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineCaptureResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + + async def begin_capture( + self, + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineCaptureParameters", + **kwargs + ) -> AsyncLROPoller["_models.VirtualMachineCaptureResult"]: + """Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used + to create similar VMs. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param parameters: Parameters supplied to the Capture Virtual Machine operation. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineCaptureParameters + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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 VirtualMachineCaptureResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineCaptureResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._capture_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualMachineCaptureResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_capture.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachine", + **kwargs + ) -> "_models.VirtualMachine": + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VirtualMachine') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, 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, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachine", + **kwargs + ) -> AsyncLROPoller["_models.VirtualMachine"]: + """The operation to create or update a virtual machine. Please note some properties can be set + only during virtual machine creation. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param parameters: Parameters supplied to the Create Virtual Machine operation. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachine + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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 VirtualMachine or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualMachine', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineUpdate", + **kwargs + ) -> "_models.VirtualMachine": + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VirtualMachineUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + 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.Compute/virtualMachines/{vmName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + vm_name: str, + parameters: "_models.VirtualMachineUpdate", + **kwargs + ) -> AsyncLROPoller["_models.VirtualMachine"]: + """The operation to update a virtual machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param parameters: Parameters supplied to the Update Virtual Machine operation. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineUpdate + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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 VirtualMachine or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualMachine', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + vm_name: str, + force_deletion: Optional[bool] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if force_deletion is not None: + query_parameters['forceDeletion'] = self._serialize.query("force_deletion", force_deletion, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + vm_name: str, + force_deletion: Optional[bool] = None, + **kwargs + ) -> AsyncLROPoller[None]: + """The operation to delete a virtual machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param force_deletion: Optional parameter to force delete virtual machines.(Feature in + Preview). + :type force_deletion: 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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + force_deletion=force_deletion, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + vm_name: str, + expand: Optional[Union[str, "_models.InstanceViewTypes"]] = None, + **kwargs + ) -> "_models.VirtualMachine": + """Retrieves information about the model view or the instance view of a virtual machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param expand: The expand expression to apply on the operation. + :type expand: str or ~azure.mgmt.compute.v2021_03_01.models.InstanceViewTypes + :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.compute.v2021_03_01.models.VirtualMachine + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, 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.Compute/virtualMachines/{vmName}'} # type: ignore + + async def instance_view( + self, + resource_group_name: str, + vm_name: str, + **kwargs + ) -> "_models.VirtualMachineInstanceView": + """Retrieves information about the run-time state of a virtual machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineInstanceView, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineInstanceView + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineInstanceView"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.instance_view.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineInstanceView', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView'} # type: ignore + + async def _convert_to_managed_disks_initial( + self, + resource_group_name: str, + vm_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._convert_to_managed_disks_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _convert_to_managed_disks_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks'} # type: ignore + + async def begin_convert_to_managed_disks( + self, + resource_group_name: str, + vm_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop- + deallocated before invoking this operation. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._convert_to_managed_disks_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_convert_to_managed_disks.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks'} # type: ignore + + async def _deallocate_initial( + self, + resource_group_name: str, + vm_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._deallocate_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + + async def begin_deallocate( + self, + resource_group_name: str, + vm_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Shuts down the virtual machine and releases the compute resources. You are not billed for the + compute resources that this virtual machine uses. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._deallocate_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_deallocate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + + async def generalize( + self, + resource_group_name: str, + vm_name: str, + **kwargs + ) -> None: + """Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the + virtual machine before performing this operation. :code:`
`For Windows, please refer to + `Create a managed image of a generalized VM in Azure `_.:code:`
`For Linux, please refer + to `How to create an image of a virtual machine or VHD `_. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_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 + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self.generalize.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + generalize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'} # type: ignore + + def list( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["_models.VirtualMachineListResult"]: + """Lists all of the virtual machines in the specified resource group. Use the nextLink property in + the response to get the next page of virtual machines. + + :param resource_group_name: The name of the resource group. + :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 VirtualMachineListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + + def list_all( + self, + status_only: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.VirtualMachineListResult"]: + """Lists all of the virtual machines in the specified subscription. Use the nextLink property in + the response to get the next page of virtual machines. + + :param status_only: statusOnly=true enables fetching run time status of all Virtual Machines in + the subscription. + :type status_only: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_all.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if status_only is not None: + query_parameters['statusOnly'] = self._serialize.query("status_only", status_only, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + + def list_available_sizes( + self, + resource_group_name: str, + vm_name: str, + **kwargs + ) -> AsyncIterable["_models.VirtualMachineSizeListResult"]: + """Lists all available virtual machine sizes to which the specified virtual machine can be + resized. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineSizeListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_available_sizes.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_available_sizes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes'} # type: ignore + + async def _power_off_initial( + self, + resource_group_name: str, + vm_name: str, + skip_shutdown: Optional[bool] = False, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._power_off_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if skip_shutdown is not None: + query_parameters['skipShutdown'] = self._serialize.query("skip_shutdown", skip_shutdown, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + + async def begin_power_off( + self, + resource_group_name: str, + vm_name: str, + skip_shutdown: Optional[bool] = False, + **kwargs + ) -> AsyncLROPoller[None]: + """The operation to power off (stop) a virtual machine. The virtual machine can be restarted with + the same provisioned resources. You are still charged for this virtual machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this + flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this + flag is false if not specified. + :type skip_shutdown: 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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._power_off_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + skip_shutdown=skip_shutdown, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_power_off.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + + async def _reapply_initial( + self, + resource_group_name: str, + vm_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self._reapply_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reapply_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply'} # type: ignore + + async def begin_reapply( + self, + resource_group_name: str, + vm_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """The operation to reapply a virtual machine's state. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._reapply_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_reapply.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply'} # type: ignore + + async def _restart_initial( + self, + resource_group_name: str, + vm_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._restart_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + + async def begin_restart( + self, + resource_group_name: str, + vm_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """The operation to restart a virtual machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._restart_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + + async def _start_initial( + self, + resource_group_name: str, + vm_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._start_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + + async def begin_start( + self, + resource_group_name: str, + vm_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """The operation to start a virtual machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._start_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + + async def _redeploy_initial( + self, + resource_group_name: str, + vm_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._redeploy_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + + async def begin_redeploy( + self, + resource_group_name: str, + vm_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Shuts down the virtual machine, moves it to a new node, and powers it back on. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._redeploy_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_redeploy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + + async def _reimage_initial( + self, + resource_group_name: str, + vm_name: str, + parameters: Optional["_models.VirtualMachineReimageParameters"] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._reimage_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'VirtualMachineReimageParameters') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage'} # type: ignore + + async def begin_reimage( + self, + resource_group_name: str, + vm_name: str, + parameters: Optional["_models.VirtualMachineReimageParameters"] = None, + **kwargs + ) -> AsyncLROPoller[None]: + """Reimages the virtual machine which has an ephemeral OS disk back to its initial state. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param parameters: Parameters supplied to the Reimage Virtual Machine operation. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineReimageParameters + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._reimage_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage'} # type: ignore + + async def retrieve_boot_diagnostics_data( + self, + resource_group_name: str, + vm_name: str, + sas_uri_expiration_time_in_minutes: Optional[int] = None, + **kwargs + ) -> "_models.RetrieveBootDiagnosticsDataResult": + """The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param sas_uri_expiration_time_in_minutes: Expiration duration in minutes for the SAS URIs with + a value between 1 to 1440 minutes. :code:`
`:code:`
`NOTE: If not specified, SAS URIs + will be generated with a default expiration duration of 120 minutes. + :type sas_uri_expiration_time_in_minutes: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RetrieveBootDiagnosticsDataResult, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.RetrieveBootDiagnosticsDataResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RetrieveBootDiagnosticsDataResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.retrieve_boot_diagnostics_data.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if sas_uri_expiration_time_in_minutes is not None: + query_parameters['sasUriExpirationTimeInMinutes'] = self._serialize.query("sas_uri_expiration_time_in_minutes", sas_uri_expiration_time_in_minutes, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RetrieveBootDiagnosticsDataResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + retrieve_boot_diagnostics_data.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData'} # type: ignore + + async def _perform_maintenance_initial( + self, + resource_group_name: str, + vm_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._perform_maintenance_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance'} # type: ignore + + async def begin_perform_maintenance( + self, + resource_group_name: str, + vm_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """The operation to perform maintenance on a virtual machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._perform_maintenance_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_perform_maintenance.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance'} # type: ignore + + async def simulate_eviction( + self, + resource_group_name: str, + vm_name: str, + **kwargs + ) -> None: + """The operation to simulate the eviction of spot virtual machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_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 + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self.simulate_eviction.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + simulate_eviction.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction'} # type: ignore + + async def _assess_patches_initial( + self, + resource_group_name: str, + vm_name: str, + **kwargs + ) -> Optional["_models.VirtualMachineAssessPatchesResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.VirtualMachineAssessPatchesResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self._assess_patches_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, 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.Compute/virtualMachines/{vmName}/assessPatches'} # type: ignore + + async def begin_assess_patches( + self, + resource_group_name: str, + vm_name: str, + **kwargs + ) -> AsyncLROPoller["_models.VirtualMachineAssessPatchesResult"]: + """Assess patches on the VM. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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.compute.v2021_03_01.models.VirtualMachineAssessPatchesResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineAssessPatchesResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._assess_patches_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualMachineAssessPatchesResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_assess_patches.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches'} # type: ignore + + async def _install_patches_initial( + self, + resource_group_name: str, + vm_name: str, + install_patches_input: "_models.VirtualMachineInstallPatchesParameters", + **kwargs + ) -> Optional["_models.VirtualMachineInstallPatchesResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.VirtualMachineInstallPatchesResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._install_patches_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(install_patches_input, 'VirtualMachineInstallPatchesParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, 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.Compute/virtualMachines/{vmName}/installPatches'} # type: ignore + + async def begin_install_patches( + self, + resource_group_name: str, + vm_name: str, + install_patches_input: "_models.VirtualMachineInstallPatchesParameters", + **kwargs + ) -> AsyncLROPoller["_models.VirtualMachineInstallPatchesResult"]: + """Installs patches on the VM. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param install_patches_input: Input for InstallPatches as directly received by the API. + :type install_patches_input: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineInstallPatchesParameters + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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.compute.v2021_03_01.models.VirtualMachineInstallPatchesResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineInstallPatchesResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._install_patches_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + install_patches_input=install_patches_input, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualMachineInstallPatchesResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_install_patches.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches'} # type: ignore + + async def _run_command_initial( + self, + resource_group_name: str, + vm_name: str, + parameters: "_models.RunCommandInput", + **kwargs + ) -> Optional["_models.RunCommandResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json, text/json" + + # Construct URL + url = self._run_command_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RunCommandInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RunCommandResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _run_command_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand'} # type: ignore + + async def begin_run_command( + self, + resource_group_name: str, + vm_name: str, + parameters: "_models.RunCommandInput", + **kwargs + ) -> AsyncLROPoller["_models.RunCommandResult"]: + """Run command on the VM. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param parameters: Parameters supplied to the Run command operation. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.RunCommandInput + :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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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 RunCommandResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.compute.v2021_03_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._run_command_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('RunCommandResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_run_command.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/models/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/models/__init__.py index fc6e37b428660..09557a3b392ee 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/models/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/models/__init__.py @@ -7,8 +7,21 @@ # -------------------------------------------------------------------------- try: + from ._models_py3 import AdditionalCapabilities + from ._models_py3 import AdditionalUnattendContent + from ._models_py3 import ApiEntityReference from ._models_py3 import ApiError from ._models_py3 import ApiErrorBase + from ._models_py3 import AutomaticOSUpgradePolicy + from ._models_py3 import AutomaticOSUpgradeProperties + from ._models_py3 import AutomaticRepairsPolicy + from ._models_py3 import AvailabilitySet + from ._models_py3 import AvailabilitySetListResult + from ._models_py3 import AvailabilitySetUpdate + from ._models_py3 import AvailablePatchSummary + from ._models_py3 import BillingProfile + from ._models_py3 import BootDiagnostics + from ._models_py3 import BootDiagnosticsInstanceView from ._models_py3 import CloudService from ._models_py3 import CloudServiceExtensionProfile from ._models_py3 import CloudServiceExtensionProperties @@ -27,35 +40,236 @@ from ._models_py3 import CloudServiceVaultAndSecretReference from ._models_py3 import CloudServiceVaultCertificate from ._models_py3 import CloudServiceVaultSecretGroup + from ._models_py3 import ComputeOperationListResult + from ._models_py3 import ComputeOperationValue + from ._models_py3 import DataDisk + from ._models_py3 import DataDiskImage + from ._models_py3 import DedicatedHost + from ._models_py3 import DedicatedHostAllocatableVM + from ._models_py3 import DedicatedHostAvailableCapacity + from ._models_py3 import DedicatedHostGroup + from ._models_py3 import DedicatedHostGroupInstanceView + from ._models_py3 import DedicatedHostGroupListResult + from ._models_py3 import DedicatedHostGroupUpdate + from ._models_py3 import DedicatedHostInstanceView + from ._models_py3 import DedicatedHostInstanceViewWithName + from ._models_py3 import DedicatedHostListResult + from ._models_py3 import DedicatedHostUpdate + from ._models_py3 import DiagnosticsProfile + from ._models_py3 import DiffDiskSettings + from ._models_py3 import DisallowedConfiguration + from ._models_py3 import DiskEncryptionSetParameters + from ._models_py3 import DiskEncryptionSettings + from ._models_py3 import DiskInstanceView + from ._models_py3 import ExtendedLocation from ._models_py3 import Extension + from ._models_py3 import HardwareProfile + from ._models_py3 import Image + from ._models_py3 import ImageDataDisk + from ._models_py3 import ImageDisk + from ._models_py3 import ImageListResult + from ._models_py3 import ImageOSDisk + from ._models_py3 import ImageReference + from ._models_py3 import ImageStorageProfile + from ._models_py3 import ImageUpdate from ._models_py3 import InnerError from ._models_py3 import InstanceSku + from ._models_py3 import InstanceViewStatus from ._models_py3 import InstanceViewStatusesSummary + from ._models_py3 import KeyVaultKeyReference + from ._models_py3 import KeyVaultSecretReference + from ._models_py3 import LastPatchInstallationSummary + from ._models_py3 import LinuxConfiguration + from ._models_py3 import LinuxParameters + from ._models_py3 import LinuxPatchSettings + from ._models_py3 import ListUsagesResult from ._models_py3 import LoadBalancerConfiguration from ._models_py3 import LoadBalancerConfigurationProperties from ._models_py3 import LoadBalancerFrontendIPConfiguration from ._models_py3 import LoadBalancerFrontendIPConfigurationProperties + from ._models_py3 import LogAnalyticsInputBase + from ._models_py3 import LogAnalyticsOperationResult + from ._models_py3 import LogAnalyticsOutput + from ._models_py3 import MaintenanceRedeployStatus + from ._models_py3 import ManagedDiskParameters + from ._models_py3 import NetworkInterfaceReference + from ._models_py3 import NetworkProfile + from ._models_py3 import OSDisk + from ._models_py3 import OSDiskImage from ._models_py3 import OSFamily from ._models_py3 import OSFamilyListResult from ._models_py3 import OSFamilyProperties + from ._models_py3 import OSProfile from ._models_py3 import OSVersion from ._models_py3 import OSVersionListResult from ._models_py3 import OSVersionProperties from ._models_py3 import OSVersionPropertiesBase + from ._models_py3 import OrchestrationServiceStateInput + from ._models_py3 import OrchestrationServiceSummary + from ._models_py3 import PatchInstallationDetail + from ._models_py3 import PatchSettings + from ._models_py3 import Plan + from ._models_py3 import ProximityPlacementGroup + from ._models_py3 import ProximityPlacementGroupListResult + from ._models_py3 import ProximityPlacementGroupUpdate + from ._models_py3 import PurchasePlan + from ._models_py3 import RecoveryWalkResponse + from ._models_py3 import RequestRateByIntervalInput + from ._models_py3 import Resource from ._models_py3 import ResourceInstanceViewStatus + from ._models_py3 import RetrieveBootDiagnosticsDataResult from ._models_py3 import RoleInstance from ._models_py3 import RoleInstanceListResult from ._models_py3 import RoleInstanceNetworkProfile from ._models_py3 import RoleInstanceProperties from ._models_py3 import RoleInstanceView from ._models_py3 import RoleInstances + from ._models_py3 import RollbackStatusInfo + from ._models_py3 import RollingUpgradePolicy + from ._models_py3 import RollingUpgradeProgressInfo + from ._models_py3 import RollingUpgradeRunningStatus + from ._models_py3 import RollingUpgradeStatusInfo + from ._models_py3 import RunCommandDocument + from ._models_py3 import RunCommandDocumentBase + from ._models_py3 import RunCommandInput + from ._models_py3 import RunCommandInputParameter + from ._models_py3 import RunCommandListResult + from ._models_py3 import RunCommandParameterDefinition + from ._models_py3 import RunCommandResult + from ._models_py3 import ScaleInPolicy + from ._models_py3 import ScheduledEventsProfile + from ._models_py3 import SecurityProfile + from ._models_py3 import Sku + from ._models_py3 import SshConfiguration + from ._models_py3 import SshPublicKey + from ._models_py3 import SshPublicKeyGenerateKeyPairResult + from ._models_py3 import SshPublicKeyResource + from ._models_py3 import SshPublicKeyUpdateResource + from ._models_py3 import SshPublicKeysGroupListResult from ._models_py3 import StatusCodeCount + from ._models_py3 import StorageProfile from ._models_py3 import SubResource + from ._models_py3 import SubResourceReadOnly + from ._models_py3 import SubResourceWithColocationStatus + from ._models_py3 import TerminateNotificationProfile + from ._models_py3 import ThrottledRequestsInput + from ._models_py3 import UefiSettings from ._models_py3 import UpdateDomain from ._models_py3 import UpdateDomainListResult + from ._models_py3 import UpdateResource + from ._models_py3 import UpgradeOperationHistoricalStatusInfo + from ._models_py3 import UpgradeOperationHistoricalStatusInfoProperties + from ._models_py3 import UpgradeOperationHistoryStatus + from ._models_py3 import UpgradePolicy + from ._models_py3 import Usage + from ._models_py3 import UsageName + from ._models_py3 import UserAssignedIdentitiesValue + from ._models_py3 import VMScaleSetConvertToSinglePlacementGroupInput + from ._models_py3 import VaultCertificate + from ._models_py3 import VaultSecretGroup + from ._models_py3 import VirtualHardDisk + from ._models_py3 import VirtualMachine + from ._models_py3 import VirtualMachineAgentInstanceView + from ._models_py3 import VirtualMachineAssessPatchesResult + from ._models_py3 import VirtualMachineCaptureParameters + from ._models_py3 import VirtualMachineCaptureResult + from ._models_py3 import VirtualMachineExtension + from ._models_py3 import VirtualMachineExtensionHandlerInstanceView + from ._models_py3 import VirtualMachineExtensionImage + from ._models_py3 import VirtualMachineExtensionInstanceView + from ._models_py3 import VirtualMachineExtensionUpdate + from ._models_py3 import VirtualMachineExtensionsListResult + from ._models_py3 import VirtualMachineHealthStatus + from ._models_py3 import VirtualMachineIdentity + from ._models_py3 import VirtualMachineImage + from ._models_py3 import VirtualMachineImageFeature + from ._models_py3 import VirtualMachineImageResource + from ._models_py3 import VirtualMachineInstallPatchesParameters + from ._models_py3 import VirtualMachineInstallPatchesResult + from ._models_py3 import VirtualMachineInstanceView + from ._models_py3 import VirtualMachineListResult + from ._models_py3 import VirtualMachinePatchStatus + from ._models_py3 import VirtualMachineReimageParameters + from ._models_py3 import VirtualMachineRunCommand + from ._models_py3 import VirtualMachineRunCommandInstanceView + from ._models_py3 import VirtualMachineRunCommandScriptSource + from ._models_py3 import VirtualMachineRunCommandUpdate + from ._models_py3 import VirtualMachineRunCommandsListResult + from ._models_py3 import VirtualMachineScaleSet + from ._models_py3 import VirtualMachineScaleSetDataDisk + from ._models_py3 import VirtualMachineScaleSetExtension + from ._models_py3 import VirtualMachineScaleSetExtensionListResult + from ._models_py3 import VirtualMachineScaleSetExtensionProfile + from ._models_py3 import VirtualMachineScaleSetExtensionUpdate + from ._models_py3 import VirtualMachineScaleSetIPConfiguration + from ._models_py3 import VirtualMachineScaleSetIdentity + from ._models_py3 import VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue + from ._models_py3 import VirtualMachineScaleSetInstanceView + from ._models_py3 import VirtualMachineScaleSetInstanceViewStatusesSummary + from ._models_py3 import VirtualMachineScaleSetIpTag + from ._models_py3 import VirtualMachineScaleSetListOSUpgradeHistory + from ._models_py3 import VirtualMachineScaleSetListResult + from ._models_py3 import VirtualMachineScaleSetListSkusResult + from ._models_py3 import VirtualMachineScaleSetListWithLinkResult + from ._models_py3 import VirtualMachineScaleSetManagedDiskParameters + from ._models_py3 import VirtualMachineScaleSetNetworkConfiguration + from ._models_py3 import VirtualMachineScaleSetNetworkConfigurationDnsSettings + from ._models_py3 import VirtualMachineScaleSetNetworkProfile + from ._models_py3 import VirtualMachineScaleSetOSDisk + from ._models_py3 import VirtualMachineScaleSetOSProfile + from ._models_py3 import VirtualMachineScaleSetPublicIPAddressConfiguration + from ._models_py3 import VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + from ._models_py3 import VirtualMachineScaleSetReimageParameters + from ._models_py3 import VirtualMachineScaleSetSku + from ._models_py3 import VirtualMachineScaleSetSkuCapacity + from ._models_py3 import VirtualMachineScaleSetStorageProfile + from ._models_py3 import VirtualMachineScaleSetUpdate + from ._models_py3 import VirtualMachineScaleSetUpdateIPConfiguration + from ._models_py3 import VirtualMachineScaleSetUpdateNetworkConfiguration + from ._models_py3 import VirtualMachineScaleSetUpdateNetworkProfile + from ._models_py3 import VirtualMachineScaleSetUpdateOSDisk + from ._models_py3 import VirtualMachineScaleSetUpdateOSProfile + from ._models_py3 import VirtualMachineScaleSetUpdatePublicIPAddressConfiguration + from ._models_py3 import VirtualMachineScaleSetUpdateStorageProfile + from ._models_py3 import VirtualMachineScaleSetUpdateVMProfile + from ._models_py3 import VirtualMachineScaleSetVM + from ._models_py3 import VirtualMachineScaleSetVMExtension + from ._models_py3 import VirtualMachineScaleSetVMExtensionUpdate + from ._models_py3 import VirtualMachineScaleSetVMExtensionsListResult + from ._models_py3 import VirtualMachineScaleSetVMExtensionsSummary + from ._models_py3 import VirtualMachineScaleSetVMInstanceIDs + from ._models_py3 import VirtualMachineScaleSetVMInstanceRequiredIDs + from ._models_py3 import VirtualMachineScaleSetVMInstanceView + from ._models_py3 import VirtualMachineScaleSetVMListResult + from ._models_py3 import VirtualMachineScaleSetVMNetworkProfileConfiguration + from ._models_py3 import VirtualMachineScaleSetVMProfile + from ._models_py3 import VirtualMachineScaleSetVMProtectionPolicy + from ._models_py3 import VirtualMachineScaleSetVMReimageParameters + from ._models_py3 import VirtualMachineSize + from ._models_py3 import VirtualMachineSizeListResult + from ._models_py3 import VirtualMachineSoftwarePatchProperties + from ._models_py3 import VirtualMachineStatusCodeCount + from ._models_py3 import VirtualMachineUpdate + from ._models_py3 import WinRMConfiguration + from ._models_py3 import WinRMListener + from ._models_py3 import WindowsConfiguration + from ._models_py3 import WindowsParameters except (SyntaxError, ImportError): + from ._models import AdditionalCapabilities # type: ignore + from ._models import AdditionalUnattendContent # type: ignore + from ._models import ApiEntityReference # type: ignore from ._models import ApiError # type: ignore from ._models import ApiErrorBase # type: ignore + from ._models import AutomaticOSUpgradePolicy # type: ignore + from ._models import AutomaticOSUpgradeProperties # type: ignore + from ._models import AutomaticRepairsPolicy # type: ignore + from ._models import AvailabilitySet # type: ignore + from ._models import AvailabilitySetListResult # type: ignore + from ._models import AvailabilitySetUpdate # type: ignore + from ._models import AvailablePatchSummary # type: ignore + from ._models import BillingProfile # type: ignore + from ._models import BootDiagnostics # type: ignore + from ._models import BootDiagnosticsInstanceView # type: ignore from ._models import CloudService # type: ignore from ._models import CloudServiceExtensionProfile # type: ignore from ._models import CloudServiceExtensionProperties # type: ignore @@ -74,41 +288,290 @@ from ._models import CloudServiceVaultAndSecretReference # type: ignore from ._models import CloudServiceVaultCertificate # type: ignore from ._models import CloudServiceVaultSecretGroup # type: ignore + from ._models import ComputeOperationListResult # type: ignore + from ._models import ComputeOperationValue # type: ignore + from ._models import DataDisk # type: ignore + from ._models import DataDiskImage # type: ignore + from ._models import DedicatedHost # type: ignore + from ._models import DedicatedHostAllocatableVM # type: ignore + from ._models import DedicatedHostAvailableCapacity # type: ignore + from ._models import DedicatedHostGroup # type: ignore + from ._models import DedicatedHostGroupInstanceView # type: ignore + from ._models import DedicatedHostGroupListResult # type: ignore + from ._models import DedicatedHostGroupUpdate # type: ignore + from ._models import DedicatedHostInstanceView # type: ignore + from ._models import DedicatedHostInstanceViewWithName # type: ignore + from ._models import DedicatedHostListResult # type: ignore + from ._models import DedicatedHostUpdate # type: ignore + from ._models import DiagnosticsProfile # type: ignore + from ._models import DiffDiskSettings # type: ignore + from ._models import DisallowedConfiguration # type: ignore + from ._models import DiskEncryptionSetParameters # type: ignore + from ._models import DiskEncryptionSettings # type: ignore + from ._models import DiskInstanceView # type: ignore + from ._models import ExtendedLocation # type: ignore from ._models import Extension # type: ignore + from ._models import HardwareProfile # type: ignore + from ._models import Image # type: ignore + from ._models import ImageDataDisk # type: ignore + from ._models import ImageDisk # type: ignore + from ._models import ImageListResult # type: ignore + from ._models import ImageOSDisk # type: ignore + from ._models import ImageReference # type: ignore + from ._models import ImageStorageProfile # type: ignore + from ._models import ImageUpdate # type: ignore from ._models import InnerError # type: ignore from ._models import InstanceSku # type: ignore + from ._models import InstanceViewStatus # type: ignore from ._models import InstanceViewStatusesSummary # type: ignore + from ._models import KeyVaultKeyReference # type: ignore + from ._models import KeyVaultSecretReference # type: ignore + from ._models import LastPatchInstallationSummary # type: ignore + from ._models import LinuxConfiguration # type: ignore + from ._models import LinuxParameters # type: ignore + from ._models import LinuxPatchSettings # type: ignore + from ._models import ListUsagesResult # type: ignore from ._models import LoadBalancerConfiguration # type: ignore from ._models import LoadBalancerConfigurationProperties # type: ignore from ._models import LoadBalancerFrontendIPConfiguration # type: ignore from ._models import LoadBalancerFrontendIPConfigurationProperties # type: ignore + from ._models import LogAnalyticsInputBase # type: ignore + from ._models import LogAnalyticsOperationResult # type: ignore + from ._models import LogAnalyticsOutput # type: ignore + from ._models import MaintenanceRedeployStatus # type: ignore + from ._models import ManagedDiskParameters # type: ignore + from ._models import NetworkInterfaceReference # type: ignore + from ._models import NetworkProfile # type: ignore + from ._models import OSDisk # type: ignore + from ._models import OSDiskImage # type: ignore from ._models import OSFamily # type: ignore from ._models import OSFamilyListResult # type: ignore from ._models import OSFamilyProperties # type: ignore + from ._models import OSProfile # type: ignore from ._models import OSVersion # type: ignore from ._models import OSVersionListResult # type: ignore from ._models import OSVersionProperties # type: ignore from ._models import OSVersionPropertiesBase # type: ignore + from ._models import OrchestrationServiceStateInput # type: ignore + from ._models import OrchestrationServiceSummary # type: ignore + from ._models import PatchInstallationDetail # type: ignore + from ._models import PatchSettings # type: ignore + from ._models import Plan # type: ignore + from ._models import ProximityPlacementGroup # type: ignore + from ._models import ProximityPlacementGroupListResult # type: ignore + from ._models import ProximityPlacementGroupUpdate # type: ignore + from ._models import PurchasePlan # type: ignore + from ._models import RecoveryWalkResponse # type: ignore + from ._models import RequestRateByIntervalInput # type: ignore + from ._models import Resource # type: ignore from ._models import ResourceInstanceViewStatus # type: ignore + from ._models import RetrieveBootDiagnosticsDataResult # type: ignore from ._models import RoleInstance # type: ignore from ._models import RoleInstanceListResult # type: ignore from ._models import RoleInstanceNetworkProfile # type: ignore from ._models import RoleInstanceProperties # type: ignore from ._models import RoleInstanceView # type: ignore from ._models import RoleInstances # type: ignore + from ._models import RollbackStatusInfo # type: ignore + from ._models import RollingUpgradePolicy # type: ignore + from ._models import RollingUpgradeProgressInfo # type: ignore + from ._models import RollingUpgradeRunningStatus # type: ignore + from ._models import RollingUpgradeStatusInfo # type: ignore + from ._models import RunCommandDocument # type: ignore + from ._models import RunCommandDocumentBase # type: ignore + from ._models import RunCommandInput # type: ignore + from ._models import RunCommandInputParameter # type: ignore + from ._models import RunCommandListResult # type: ignore + from ._models import RunCommandParameterDefinition # type: ignore + from ._models import RunCommandResult # type: ignore + from ._models import ScaleInPolicy # type: ignore + from ._models import ScheduledEventsProfile # type: ignore + from ._models import SecurityProfile # type: ignore + from ._models import Sku # type: ignore + from ._models import SshConfiguration # type: ignore + from ._models import SshPublicKey # type: ignore + from ._models import SshPublicKeyGenerateKeyPairResult # type: ignore + from ._models import SshPublicKeyResource # type: ignore + from ._models import SshPublicKeyUpdateResource # type: ignore + from ._models import SshPublicKeysGroupListResult # type: ignore from ._models import StatusCodeCount # type: ignore + from ._models import StorageProfile # type: ignore from ._models import SubResource # type: ignore + from ._models import SubResourceReadOnly # type: ignore + from ._models import SubResourceWithColocationStatus # type: ignore + from ._models import TerminateNotificationProfile # type: ignore + from ._models import ThrottledRequestsInput # type: ignore + from ._models import UefiSettings # type: ignore from ._models import UpdateDomain # type: ignore from ._models import UpdateDomainListResult # type: ignore + from ._models import UpdateResource # type: ignore + from ._models import UpgradeOperationHistoricalStatusInfo # type: ignore + from ._models import UpgradeOperationHistoricalStatusInfoProperties # type: ignore + from ._models import UpgradeOperationHistoryStatus # type: ignore + from ._models import UpgradePolicy # type: ignore + from ._models import Usage # type: ignore + from ._models import UsageName # type: ignore + from ._models import UserAssignedIdentitiesValue # type: ignore + from ._models import VMScaleSetConvertToSinglePlacementGroupInput # type: ignore + from ._models import VaultCertificate # type: ignore + from ._models import VaultSecretGroup # type: ignore + from ._models import VirtualHardDisk # type: ignore + from ._models import VirtualMachine # type: ignore + from ._models import VirtualMachineAgentInstanceView # type: ignore + from ._models import VirtualMachineAssessPatchesResult # type: ignore + from ._models import VirtualMachineCaptureParameters # type: ignore + from ._models import VirtualMachineCaptureResult # type: ignore + from ._models import VirtualMachineExtension # type: ignore + from ._models import VirtualMachineExtensionHandlerInstanceView # type: ignore + from ._models import VirtualMachineExtensionImage # type: ignore + from ._models import VirtualMachineExtensionInstanceView # type: ignore + from ._models import VirtualMachineExtensionUpdate # type: ignore + from ._models import VirtualMachineExtensionsListResult # type: ignore + from ._models import VirtualMachineHealthStatus # type: ignore + from ._models import VirtualMachineIdentity # type: ignore + from ._models import VirtualMachineImage # type: ignore + from ._models import VirtualMachineImageFeature # type: ignore + from ._models import VirtualMachineImageResource # type: ignore + from ._models import VirtualMachineInstallPatchesParameters # type: ignore + from ._models import VirtualMachineInstallPatchesResult # type: ignore + from ._models import VirtualMachineInstanceView # type: ignore + from ._models import VirtualMachineListResult # type: ignore + from ._models import VirtualMachinePatchStatus # type: ignore + from ._models import VirtualMachineReimageParameters # type: ignore + from ._models import VirtualMachineRunCommand # type: ignore + from ._models import VirtualMachineRunCommandInstanceView # type: ignore + from ._models import VirtualMachineRunCommandScriptSource # type: ignore + from ._models import VirtualMachineRunCommandUpdate # type: ignore + from ._models import VirtualMachineRunCommandsListResult # type: ignore + from ._models import VirtualMachineScaleSet # type: ignore + from ._models import VirtualMachineScaleSetDataDisk # type: ignore + from ._models import VirtualMachineScaleSetExtension # type: ignore + from ._models import VirtualMachineScaleSetExtensionListResult # type: ignore + from ._models import VirtualMachineScaleSetExtensionProfile # type: ignore + from ._models import VirtualMachineScaleSetExtensionUpdate # type: ignore + from ._models import VirtualMachineScaleSetIPConfiguration # type: ignore + from ._models import VirtualMachineScaleSetIdentity # type: ignore + from ._models import VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue # type: ignore + from ._models import VirtualMachineScaleSetInstanceView # type: ignore + from ._models import VirtualMachineScaleSetInstanceViewStatusesSummary # type: ignore + from ._models import VirtualMachineScaleSetIpTag # type: ignore + from ._models import VirtualMachineScaleSetListOSUpgradeHistory # type: ignore + from ._models import VirtualMachineScaleSetListResult # type: ignore + from ._models import VirtualMachineScaleSetListSkusResult # type: ignore + from ._models import VirtualMachineScaleSetListWithLinkResult # type: ignore + from ._models import VirtualMachineScaleSetManagedDiskParameters # type: ignore + from ._models import VirtualMachineScaleSetNetworkConfiguration # type: ignore + from ._models import VirtualMachineScaleSetNetworkConfigurationDnsSettings # type: ignore + from ._models import VirtualMachineScaleSetNetworkProfile # type: ignore + from ._models import VirtualMachineScaleSetOSDisk # type: ignore + from ._models import VirtualMachineScaleSetOSProfile # type: ignore + from ._models import VirtualMachineScaleSetPublicIPAddressConfiguration # type: ignore + from ._models import VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings # type: ignore + from ._models import VirtualMachineScaleSetReimageParameters # type: ignore + from ._models import VirtualMachineScaleSetSku # type: ignore + from ._models import VirtualMachineScaleSetSkuCapacity # type: ignore + from ._models import VirtualMachineScaleSetStorageProfile # type: ignore + from ._models import VirtualMachineScaleSetUpdate # type: ignore + from ._models import VirtualMachineScaleSetUpdateIPConfiguration # type: ignore + from ._models import VirtualMachineScaleSetUpdateNetworkConfiguration # type: ignore + from ._models import VirtualMachineScaleSetUpdateNetworkProfile # type: ignore + from ._models import VirtualMachineScaleSetUpdateOSDisk # type: ignore + from ._models import VirtualMachineScaleSetUpdateOSProfile # type: ignore + from ._models import VirtualMachineScaleSetUpdatePublicIPAddressConfiguration # type: ignore + from ._models import VirtualMachineScaleSetUpdateStorageProfile # type: ignore + from ._models import VirtualMachineScaleSetUpdateVMProfile # type: ignore + from ._models import VirtualMachineScaleSetVM # type: ignore + from ._models import VirtualMachineScaleSetVMExtension # type: ignore + from ._models import VirtualMachineScaleSetVMExtensionUpdate # type: ignore + from ._models import VirtualMachineScaleSetVMExtensionsListResult # type: ignore + from ._models import VirtualMachineScaleSetVMExtensionsSummary # type: ignore + from ._models import VirtualMachineScaleSetVMInstanceIDs # type: ignore + from ._models import VirtualMachineScaleSetVMInstanceRequiredIDs # type: ignore + from ._models import VirtualMachineScaleSetVMInstanceView # type: ignore + from ._models import VirtualMachineScaleSetVMListResult # type: ignore + from ._models import VirtualMachineScaleSetVMNetworkProfileConfiguration # type: ignore + from ._models import VirtualMachineScaleSetVMProfile # type: ignore + from ._models import VirtualMachineScaleSetVMProtectionPolicy # type: ignore + from ._models import VirtualMachineScaleSetVMReimageParameters # type: ignore + from ._models import VirtualMachineSize # type: ignore + from ._models import VirtualMachineSizeListResult # type: ignore + from ._models import VirtualMachineSoftwarePatchProperties # type: ignore + from ._models import VirtualMachineStatusCodeCount # type: ignore + from ._models import VirtualMachineUpdate # type: ignore + from ._models import WinRMConfiguration # type: ignore + from ._models import WinRMListener # type: ignore + from ._models import WindowsConfiguration # type: ignore + from ._models import WindowsParameters # type: ignore from ._compute_management_client_enums import ( + AvailabilitySetSkuTypes, + CachingTypes, CloudServiceUpgradeMode, + DedicatedHostLicenseTypes, + DiffDiskOptions, + DiffDiskPlacement, + DiskCreateOptionTypes, + DiskDetachOptionTypes, + ExecutionState, + ExpandTypesForGetVMScaleSets, + ExtendedLocationTypes, + HyperVGenerationType, + HyperVGenerationTypes, + IPVersion, + InstanceViewTypes, + IntervalInMins, + LinuxVMGuestPatchMode, + MaintenanceOperationResultCodeTypes, + OperatingSystemStateTypes, + OperatingSystemTypes, + OrchestrationMode, + OrchestrationServiceNames, + OrchestrationServiceState, + OrchestrationServiceStateAction, + PatchAssessmentState, + PatchInstallationState, + PatchOperationStatus, + ProtocolTypes, + ProximityPlacementGroupType, + ResourceIdentityType, + RollingUpgradeActionType, + RollingUpgradeStatusCode, + SettingNames, StatusLevelTypes, + StorageAccountTypes, + UpgradeMode, + UpgradeOperationInvoker, + UpgradeState, + VMGuestPatchClassificationLinux, + VMGuestPatchClassificationWindows, + VMGuestPatchRebootBehavior, + VMGuestPatchRebootSetting, + VMGuestPatchRebootStatus, + VirtualMachineEvictionPolicyTypes, + VirtualMachinePriorityTypes, + VirtualMachineScaleSetScaleInRules, + VirtualMachineScaleSetSkuScaleType, + VirtualMachineSizeTypes, + VmDiskTypes, + WindowsVMGuestPatchMode, ) __all__ = [ + 'AdditionalCapabilities', + 'AdditionalUnattendContent', + 'ApiEntityReference', 'ApiError', 'ApiErrorBase', + 'AutomaticOSUpgradePolicy', + 'AutomaticOSUpgradeProperties', + 'AutomaticRepairsPolicy', + 'AvailabilitySet', + 'AvailabilitySetListResult', + 'AvailabilitySetUpdate', + 'AvailablePatchSummary', + 'BillingProfile', + 'BootDiagnostics', + 'BootDiagnosticsInstanceView', 'CloudService', 'CloudServiceExtensionProfile', 'CloudServiceExtensionProperties', @@ -127,32 +590,268 @@ 'CloudServiceVaultAndSecretReference', 'CloudServiceVaultCertificate', 'CloudServiceVaultSecretGroup', + 'ComputeOperationListResult', + 'ComputeOperationValue', + 'DataDisk', + 'DataDiskImage', + 'DedicatedHost', + 'DedicatedHostAllocatableVM', + 'DedicatedHostAvailableCapacity', + 'DedicatedHostGroup', + 'DedicatedHostGroupInstanceView', + 'DedicatedHostGroupListResult', + 'DedicatedHostGroupUpdate', + 'DedicatedHostInstanceView', + 'DedicatedHostInstanceViewWithName', + 'DedicatedHostListResult', + 'DedicatedHostUpdate', + 'DiagnosticsProfile', + 'DiffDiskSettings', + 'DisallowedConfiguration', + 'DiskEncryptionSetParameters', + 'DiskEncryptionSettings', + 'DiskInstanceView', + 'ExtendedLocation', 'Extension', + 'HardwareProfile', + 'Image', + 'ImageDataDisk', + 'ImageDisk', + 'ImageListResult', + 'ImageOSDisk', + 'ImageReference', + 'ImageStorageProfile', + 'ImageUpdate', 'InnerError', 'InstanceSku', + 'InstanceViewStatus', 'InstanceViewStatusesSummary', + 'KeyVaultKeyReference', + 'KeyVaultSecretReference', + 'LastPatchInstallationSummary', + 'LinuxConfiguration', + 'LinuxParameters', + 'LinuxPatchSettings', + 'ListUsagesResult', 'LoadBalancerConfiguration', 'LoadBalancerConfigurationProperties', 'LoadBalancerFrontendIPConfiguration', 'LoadBalancerFrontendIPConfigurationProperties', + 'LogAnalyticsInputBase', + 'LogAnalyticsOperationResult', + 'LogAnalyticsOutput', + 'MaintenanceRedeployStatus', + 'ManagedDiskParameters', + 'NetworkInterfaceReference', + 'NetworkProfile', + 'OSDisk', + 'OSDiskImage', 'OSFamily', 'OSFamilyListResult', 'OSFamilyProperties', + 'OSProfile', 'OSVersion', 'OSVersionListResult', 'OSVersionProperties', 'OSVersionPropertiesBase', + 'OrchestrationServiceStateInput', + 'OrchestrationServiceSummary', + 'PatchInstallationDetail', + 'PatchSettings', + 'Plan', + 'ProximityPlacementGroup', + 'ProximityPlacementGroupListResult', + 'ProximityPlacementGroupUpdate', + 'PurchasePlan', + 'RecoveryWalkResponse', + 'RequestRateByIntervalInput', + 'Resource', 'ResourceInstanceViewStatus', + 'RetrieveBootDiagnosticsDataResult', 'RoleInstance', 'RoleInstanceListResult', 'RoleInstanceNetworkProfile', 'RoleInstanceProperties', 'RoleInstanceView', 'RoleInstances', + 'RollbackStatusInfo', + 'RollingUpgradePolicy', + 'RollingUpgradeProgressInfo', + 'RollingUpgradeRunningStatus', + 'RollingUpgradeStatusInfo', + 'RunCommandDocument', + 'RunCommandDocumentBase', + 'RunCommandInput', + 'RunCommandInputParameter', + 'RunCommandListResult', + 'RunCommandParameterDefinition', + 'RunCommandResult', + 'ScaleInPolicy', + 'ScheduledEventsProfile', + 'SecurityProfile', + 'Sku', + 'SshConfiguration', + 'SshPublicKey', + 'SshPublicKeyGenerateKeyPairResult', + 'SshPublicKeyResource', + 'SshPublicKeyUpdateResource', + 'SshPublicKeysGroupListResult', 'StatusCodeCount', + 'StorageProfile', 'SubResource', + 'SubResourceReadOnly', + 'SubResourceWithColocationStatus', + 'TerminateNotificationProfile', + 'ThrottledRequestsInput', + 'UefiSettings', 'UpdateDomain', 'UpdateDomainListResult', + 'UpdateResource', + 'UpgradeOperationHistoricalStatusInfo', + 'UpgradeOperationHistoricalStatusInfoProperties', + 'UpgradeOperationHistoryStatus', + 'UpgradePolicy', + 'Usage', + 'UsageName', + 'UserAssignedIdentitiesValue', + 'VMScaleSetConvertToSinglePlacementGroupInput', + 'VaultCertificate', + 'VaultSecretGroup', + 'VirtualHardDisk', + 'VirtualMachine', + 'VirtualMachineAgentInstanceView', + 'VirtualMachineAssessPatchesResult', + 'VirtualMachineCaptureParameters', + 'VirtualMachineCaptureResult', + 'VirtualMachineExtension', + 'VirtualMachineExtensionHandlerInstanceView', + 'VirtualMachineExtensionImage', + 'VirtualMachineExtensionInstanceView', + 'VirtualMachineExtensionUpdate', + 'VirtualMachineExtensionsListResult', + 'VirtualMachineHealthStatus', + 'VirtualMachineIdentity', + 'VirtualMachineImage', + 'VirtualMachineImageFeature', + 'VirtualMachineImageResource', + 'VirtualMachineInstallPatchesParameters', + 'VirtualMachineInstallPatchesResult', + 'VirtualMachineInstanceView', + 'VirtualMachineListResult', + 'VirtualMachinePatchStatus', + 'VirtualMachineReimageParameters', + 'VirtualMachineRunCommand', + 'VirtualMachineRunCommandInstanceView', + 'VirtualMachineRunCommandScriptSource', + 'VirtualMachineRunCommandUpdate', + 'VirtualMachineRunCommandsListResult', + 'VirtualMachineScaleSet', + 'VirtualMachineScaleSetDataDisk', + 'VirtualMachineScaleSetExtension', + 'VirtualMachineScaleSetExtensionListResult', + 'VirtualMachineScaleSetExtensionProfile', + 'VirtualMachineScaleSetExtensionUpdate', + 'VirtualMachineScaleSetIPConfiguration', + 'VirtualMachineScaleSetIdentity', + 'VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue', + 'VirtualMachineScaleSetInstanceView', + 'VirtualMachineScaleSetInstanceViewStatusesSummary', + 'VirtualMachineScaleSetIpTag', + 'VirtualMachineScaleSetListOSUpgradeHistory', + 'VirtualMachineScaleSetListResult', + 'VirtualMachineScaleSetListSkusResult', + 'VirtualMachineScaleSetListWithLinkResult', + 'VirtualMachineScaleSetManagedDiskParameters', + 'VirtualMachineScaleSetNetworkConfiguration', + 'VirtualMachineScaleSetNetworkConfigurationDnsSettings', + 'VirtualMachineScaleSetNetworkProfile', + 'VirtualMachineScaleSetOSDisk', + 'VirtualMachineScaleSetOSProfile', + 'VirtualMachineScaleSetPublicIPAddressConfiguration', + 'VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings', + 'VirtualMachineScaleSetReimageParameters', + 'VirtualMachineScaleSetSku', + 'VirtualMachineScaleSetSkuCapacity', + 'VirtualMachineScaleSetStorageProfile', + 'VirtualMachineScaleSetUpdate', + 'VirtualMachineScaleSetUpdateIPConfiguration', + 'VirtualMachineScaleSetUpdateNetworkConfiguration', + 'VirtualMachineScaleSetUpdateNetworkProfile', + 'VirtualMachineScaleSetUpdateOSDisk', + 'VirtualMachineScaleSetUpdateOSProfile', + 'VirtualMachineScaleSetUpdatePublicIPAddressConfiguration', + 'VirtualMachineScaleSetUpdateStorageProfile', + 'VirtualMachineScaleSetUpdateVMProfile', + 'VirtualMachineScaleSetVM', + 'VirtualMachineScaleSetVMExtension', + 'VirtualMachineScaleSetVMExtensionUpdate', + 'VirtualMachineScaleSetVMExtensionsListResult', + 'VirtualMachineScaleSetVMExtensionsSummary', + 'VirtualMachineScaleSetVMInstanceIDs', + 'VirtualMachineScaleSetVMInstanceRequiredIDs', + 'VirtualMachineScaleSetVMInstanceView', + 'VirtualMachineScaleSetVMListResult', + 'VirtualMachineScaleSetVMNetworkProfileConfiguration', + 'VirtualMachineScaleSetVMProfile', + 'VirtualMachineScaleSetVMProtectionPolicy', + 'VirtualMachineScaleSetVMReimageParameters', + 'VirtualMachineSize', + 'VirtualMachineSizeListResult', + 'VirtualMachineSoftwarePatchProperties', + 'VirtualMachineStatusCodeCount', + 'VirtualMachineUpdate', + 'WinRMConfiguration', + 'WinRMListener', + 'WindowsConfiguration', + 'WindowsParameters', + 'AvailabilitySetSkuTypes', + 'CachingTypes', 'CloudServiceUpgradeMode', + 'DedicatedHostLicenseTypes', + 'DiffDiskOptions', + 'DiffDiskPlacement', + 'DiskCreateOptionTypes', + 'DiskDetachOptionTypes', + 'ExecutionState', + 'ExpandTypesForGetVMScaleSets', + 'ExtendedLocationTypes', + 'HyperVGenerationType', + 'HyperVGenerationTypes', + 'IPVersion', + 'InstanceViewTypes', + 'IntervalInMins', + 'LinuxVMGuestPatchMode', + 'MaintenanceOperationResultCodeTypes', + 'OperatingSystemStateTypes', + 'OperatingSystemTypes', + 'OrchestrationMode', + 'OrchestrationServiceNames', + 'OrchestrationServiceState', + 'OrchestrationServiceStateAction', + 'PatchAssessmentState', + 'PatchInstallationState', + 'PatchOperationStatus', + 'ProtocolTypes', + 'ProximityPlacementGroupType', + 'ResourceIdentityType', + 'RollingUpgradeActionType', + 'RollingUpgradeStatusCode', + 'SettingNames', 'StatusLevelTypes', + 'StorageAccountTypes', + 'UpgradeMode', + 'UpgradeOperationInvoker', + 'UpgradeState', + 'VMGuestPatchClassificationLinux', + 'VMGuestPatchClassificationWindows', + 'VMGuestPatchRebootBehavior', + 'VMGuestPatchRebootSetting', + 'VMGuestPatchRebootStatus', + 'VirtualMachineEvictionPolicyTypes', + 'VirtualMachinePriorityTypes', + 'VirtualMachineScaleSetScaleInRules', + 'VirtualMachineScaleSetSkuScaleType', + 'VirtualMachineSizeTypes', + 'VmDiskTypes', + 'WindowsVMGuestPatchMode', ] diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/models/_compute_management_client_enums.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/models/_compute_management_client_enums.py index 2335366377fda..b79b15941a279 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/models/_compute_management_client_enums.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/models/_compute_management_client_enums.py @@ -26,6 +26,25 @@ def __getattr__(cls, name): raise AttributeError(name) +class AvailabilitySetSkuTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the sku of an Availability Set. Use 'Aligned' for virtual machines with managed disks + and 'Classic' for virtual machines with unmanaged disks. Default value is 'Classic'. + """ + + CLASSIC = "Classic" + ALIGNED = "Aligned" + +class CachingTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the caching requirements. :code:`
`:code:`
` Possible values are: + :code:`
`:code:`
` **None** :code:`
`:code:`
` **ReadOnly** + :code:`
`:code:`
` **ReadWrite** :code:`
`:code:`
` Default: **None for Standard + storage. ReadOnly for Premium storage** + """ + + NONE = "None" + READ_ONLY = "ReadOnly" + READ_WRITE = "ReadWrite" + class CloudServiceUpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Update mode for the cloud service. Role instances are allocated to update domains when the service is deployed. Updates can be initiated manually in each update domain or initiated @@ -41,6 +60,269 @@ class CloudServiceUpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum MANUAL = "Manual" SIMULTANEOUS = "Simultaneous" +class DedicatedHostLicenseTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the software license type that will be applied to the VMs deployed on the dedicated + host. :code:`
`:code:`
` Possible values are: :code:`
`:code:`
` **None** + :code:`
`:code:`
` **Windows_Server_Hybrid** :code:`
`:code:`
` + **Windows_Server_Perpetual** :code:`
`:code:`
` Default: **None** + """ + + NONE = "None" + WINDOWS_SERVER_HYBRID = "Windows_Server_Hybrid" + WINDOWS_SERVER_PERPETUAL = "Windows_Server_Perpetual" + +class DiffDiskOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the ephemeral disk option for operating system disk. + """ + + LOCAL = "Local" + +class DiffDiskPlacement(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the ephemeral disk placement for operating system disk. This property can be used by + user in the request to choose the location i.e, cache disk or resource disk space for Ephemeral + OS disk provisioning. For more information on Ephemeral OS disk size requirements, please refer + Ephemeral OS disk size requirements for Windows VM at https://docs.microsoft.com/en- + us/azure/virtual-machines/windows/ephemeral-os-disks#size-requirements and Linux VM at + https://docs.microsoft.com/en-us/azure/virtual-machines/linux/ephemeral-os-disks#size- + requirements + """ + + CACHE_DISK = "CacheDisk" + RESOURCE_DISK = "ResourceDisk" + +class DiskCreateOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies how the virtual machine should be created.:code:`
`:code:`
` Possible values + are::code:`
`:code:`
` **Attach** \u2013 This value is used when you are using a + specialized disk to create the virtual machine.:code:`
`:code:`
` **FromImage** \u2013 + This value is used when you are using an image to create the virtual machine. If you are using + a platform image, you also use the imageReference element described above. If you are using a + marketplace image, you also use the plan element previously described. + """ + + FROM_IMAGE = "FromImage" + EMPTY = "Empty" + ATTACH = "Attach" + +class DiskDetachOptionTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the detach behavior to be used while detaching a disk or which is already in the + process of detachment from the virtual machine. Supported values: **ForceDetach**. + :code:`
`:code:`
` detachOption: **ForceDetach** is applicable only for managed data + disks. If a previous detachment attempt of the data disk did not complete due to an unexpected + failure from the virtual machine and the disk is still not released then use force-detach as a + last resort option to detach the disk forcibly from the VM. All writes might not have been + flushed when using this detach behavior. :code:`
`:code:`
` This feature is still in + preview mode and is not supported for VirtualMachineScaleSet. To force-detach a data disk + update toBeDetached to 'true' along with setting detachOption: 'ForceDetach'. + """ + + FORCE_DETACH = "ForceDetach" + +class ExecutionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Script execution status. + """ + + UNKNOWN = "Unknown" + PENDING = "Pending" + RUNNING = "Running" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + TIMED_OUT = "TimedOut" + CANCELED = "Canceled" + +class ExpandTypesForGetVMScaleSets(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + USER_DATA = "userData" + +class ExtendedLocationTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of extendedLocation. + """ + + EDGE_ZONE = "EdgeZone" + +class HyperVGenerationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the HyperVGeneration Type associated with a resource + """ + + V1 = "V1" + V2 = "V2" + +class HyperVGenerationTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the HyperVGeneration Type + """ + + V1 = "V1" + V2 = "V2" + +class InstanceViewTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + INSTANCE_VIEW = "instanceView" + USER_DATA = "userData" + +class IntervalInMins(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Interval value in minutes used to create LogAnalytics call rate logs. + """ + + THREE_MINS = "ThreeMins" + FIVE_MINS = "FiveMins" + THIRTY_MINS = "ThirtyMins" + SIXTY_MINS = "SixtyMins" + +class IPVersion(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Available from Api-Version 2017-03-30 onwards, it represents whether the specific + ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and + 'IPv6'. + """ + + I_PV4 = "IPv4" + I_PV6 = "IPv6" + +class LinuxVMGuestPatchMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the mode of VM Guest Patching to IaaS virtual machine.:code:`
`:code:`
` + Possible values are::code:`
`:code:`
` **ImageDefault** - The virtual machine's + default patching configuration is used. :code:`
`:code:`
` **AutomaticByPlatform** - + The virtual machine will be automatically updated by the platform. The property + provisionVMAgent must be true + """ + + IMAGE_DEFAULT = "ImageDefault" + AUTOMATIC_BY_PLATFORM = "AutomaticByPlatform" + +class MaintenanceOperationResultCodeTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The Last Maintenance Operation Result Code. + """ + + NONE = "None" + RETRY_LATER = "RetryLater" + MAINTENANCE_ABORTED = "MaintenanceAborted" + MAINTENANCE_COMPLETED = "MaintenanceCompleted" + +class OperatingSystemStateTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The OS State. + """ + + #: Generalized image. Needs to be provisioned during deployment time. + GENERALIZED = "Generalized" + #: Specialized image. Contains already provisioned OS Disk. + SPECIALIZED = "Specialized" + +class OperatingSystemTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The operating system of the osDiskImage. + """ + + WINDOWS = "Windows" + LINUX = "Linux" + +class OrchestrationMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the orchestration mode for the virtual machine scale set. + """ + + UNIFORM = "Uniform" + FLEXIBLE = "Flexible" + +class OrchestrationServiceNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The name of the service. + """ + + AUTOMATIC_REPAIRS = "AutomaticRepairs" + DUMMY_ORCHESTRATION_SERVICE_NAME = "DummyOrchestrationServiceName" + +class OrchestrationServiceState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The current state of the service. + """ + + NOT_RUNNING = "NotRunning" + RUNNING = "Running" + SUSPENDED = "Suspended" + +class OrchestrationServiceStateAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The action to be performed. + """ + + RESUME = "Resume" + SUSPEND = "Suspend" + +class PatchAssessmentState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Describes the availability of a given patch. + """ + + UNKNOWN = "Unknown" + AVAILABLE = "Available" + +class PatchInstallationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The state of the patch after the installation operation completed. + """ + + UNKNOWN = "Unknown" + INSTALLED = "Installed" + FAILED = "Failed" + EXCLUDED = "Excluded" + NOT_SELECTED = "NotSelected" + PENDING = "Pending" + +class PatchOperationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """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 ProtocolTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the protocol of WinRM listener. :code:`
`:code:`
` Possible values are: + :code:`
`\ **http** :code:`
`:code:`
` **https** + """ + + HTTP = "Http" + HTTPS = "Https" + +class ProximityPlacementGroupType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the type of the proximity placement group. :code:`
`:code:`
` Possible values + are: :code:`
`:code:`
` **Standard** : Co-locate resources within an Azure region or + Availability Zone. :code:`
`:code:`
` **Ultra** : For future use. + """ + + STANDARD = "Standard" + ULTRA = "Ultra" + +class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity used for the virtual machine. The type 'SystemAssigned, UserAssigned' + includes both an implicitly created identity and a set of user assigned identities. The type + 'None' will remove any identities from the virtual machine. + """ + + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" + NONE = "None" + +class RollingUpgradeActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The last action performed on the rolling upgrade. + """ + + START = "Start" + CANCEL = "Cancel" + +class RollingUpgradeStatusCode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Code indicating the current status of the upgrade. + """ + + ROLLING_FORWARD = "RollingForward" + CANCELLED = "Cancelled" + COMPLETED = "Completed" + FAULTED = "Faulted" + +class SettingNames(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the name of the setting to which the content applies. Possible values are: + FirstLogonCommands and AutoLogon. + """ + + AUTO_LOGON = "AutoLogon" + FIRST_LOGON_COMMANDS = "FirstLogonCommands" + class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The level code. """ @@ -48,3 +330,331 @@ class StatusLevelTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): INFO = "Info" WARNING = "Warning" ERROR = "Error" + +class StorageAccountTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the storage account type for the managed disk. Managed OS disk storage account type + can only be set when you create the scale set. NOTE: UltraSSD_LRS can only be used with data + disks. It cannot be used with OS Disk. Standard_LRS uses Standard HDD. StandardSSD_LRS uses + Standard SSD. Premium_LRS uses Premium SSD. UltraSSD_LRS uses Ultra disk. Premium_ZRS uses + Premium SSD zone redundant storage. StandardSSD_ZRS uses Standard SSD zone redundant storage. + For more information regarding disks supported for Windows Virtual Machines, refer to + https://docs.microsoft.com/en-us/azure/virtual-machines/windows/disks-types and, for Linux + Virtual Machines, refer to https://docs.microsoft.com/en-us/azure/virtual-machines/linux/disks- + types + """ + + STANDARD_LRS = "Standard_LRS" + PREMIUM_LRS = "Premium_LRS" + STANDARD_SSD_LRS = "StandardSSD_LRS" + ULTRA_SSD_LRS = "UltraSSD_LRS" + PREMIUM_ZRS = "Premium_ZRS" + STANDARD_SSD_ZRS = "StandardSSD_ZRS" + +class UpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the mode of an upgrade to virtual machines in the scale set.:code:`
`:code:`
` Possible values are::code:`
`:code:`
` **Manual** - You control the application + of updates to virtual machines in the scale set. You do this by using the manualUpgrade + action.:code:`
`:code:`
` **Automatic** - All virtual machines in the scale set are + automatically updated at the same time. + """ + + AUTOMATIC = "Automatic" + MANUAL = "Manual" + ROLLING = "Rolling" + +class UpgradeOperationInvoker(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Invoker of the Upgrade Operation + """ + + UNKNOWN = "Unknown" + USER = "User" + PLATFORM = "Platform" + +class UpgradeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Code indicating the current status of the upgrade. + """ + + ROLLING_FORWARD = "RollingForward" + CANCELLED = "Cancelled" + COMPLETED = "Completed" + FAULTED = "Faulted" + +class VirtualMachineEvictionPolicyTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the eviction policy for the Azure Spot VM/VMSS + """ + + DEALLOCATE = "Deallocate" + DELETE = "Delete" + +class VirtualMachinePriorityTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the priority for a standalone virtual machine or the virtual machines in the scale + set. :code:`
`:code:`
` 'Low' enum will be deprecated in the future, please use 'Spot' as + the enum to deploy Azure Spot VM/VMSS. + """ + + REGULAR = "Regular" + LOW = "Low" + SPOT = "Spot" + +class VirtualMachineScaleSetScaleInRules(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + DEFAULT = "Default" + OLDEST_VM = "OldestVM" + NEWEST_VM = "NewestVM" + +class VirtualMachineScaleSetSkuScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The scale type applicable to the sku. + """ + + AUTOMATIC = "Automatic" + NONE = "None" + +class VirtualMachineSizeTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the size of the virtual machine. :code:`
`:code:`
` The enum data type is + currently deprecated and will be removed by December 23rd 2023. :code:`
`:code:`
` + Recommended way to get the list of available sizes is using these APIs: + :code:`
`:code:`
` `List all available virtual machine sizes in an availability set + `_ + :code:`
`:code:`
` `List all available virtual machine sizes in a region + `_ + :code:`
`:code:`
` `List all available virtual machine sizes for resizing + `_. For more + information about virtual machine sizes, see `Sizes for virtual machines + `_. :code:`
`:code:`
` The + available VM sizes depend on region and availability set. + """ + + BASIC_A0 = "Basic_A0" + BASIC_A1 = "Basic_A1" + BASIC_A2 = "Basic_A2" + BASIC_A3 = "Basic_A3" + BASIC_A4 = "Basic_A4" + STANDARD_A0 = "Standard_A0" + STANDARD_A1 = "Standard_A1" + STANDARD_A2 = "Standard_A2" + STANDARD_A3 = "Standard_A3" + STANDARD_A4 = "Standard_A4" + STANDARD_A5 = "Standard_A5" + STANDARD_A6 = "Standard_A6" + STANDARD_A7 = "Standard_A7" + STANDARD_A8 = "Standard_A8" + STANDARD_A9 = "Standard_A9" + STANDARD_A10 = "Standard_A10" + STANDARD_A11 = "Standard_A11" + STANDARD_A1_V2 = "Standard_A1_v2" + STANDARD_A2_V2 = "Standard_A2_v2" + STANDARD_A4_V2 = "Standard_A4_v2" + STANDARD_A8_V2 = "Standard_A8_v2" + STANDARD_A2_M_V2 = "Standard_A2m_v2" + STANDARD_A4_M_V2 = "Standard_A4m_v2" + STANDARD_A8_M_V2 = "Standard_A8m_v2" + STANDARD_B1_S = "Standard_B1s" + STANDARD_B1_MS = "Standard_B1ms" + STANDARD_B2_S = "Standard_B2s" + STANDARD_B2_MS = "Standard_B2ms" + STANDARD_B4_MS = "Standard_B4ms" + STANDARD_B8_MS = "Standard_B8ms" + STANDARD_D1 = "Standard_D1" + STANDARD_D2 = "Standard_D2" + STANDARD_D3 = "Standard_D3" + STANDARD_D4 = "Standard_D4" + STANDARD_D11 = "Standard_D11" + STANDARD_D12 = "Standard_D12" + STANDARD_D13 = "Standard_D13" + STANDARD_D14 = "Standard_D14" + STANDARD_D1_V2 = "Standard_D1_v2" + STANDARD_D2_V2 = "Standard_D2_v2" + STANDARD_D3_V2 = "Standard_D3_v2" + STANDARD_D4_V2 = "Standard_D4_v2" + STANDARD_D5_V2 = "Standard_D5_v2" + STANDARD_D2_V3 = "Standard_D2_v3" + STANDARD_D4_V3 = "Standard_D4_v3" + STANDARD_D8_V3 = "Standard_D8_v3" + STANDARD_D16_V3 = "Standard_D16_v3" + STANDARD_D32_V3 = "Standard_D32_v3" + STANDARD_D64_V3 = "Standard_D64_v3" + STANDARD_D2_S_V3 = "Standard_D2s_v3" + STANDARD_D4_S_V3 = "Standard_D4s_v3" + STANDARD_D8_S_V3 = "Standard_D8s_v3" + STANDARD_D16_S_V3 = "Standard_D16s_v3" + STANDARD_D32_S_V3 = "Standard_D32s_v3" + STANDARD_D64_S_V3 = "Standard_D64s_v3" + STANDARD_D11_V2 = "Standard_D11_v2" + STANDARD_D12_V2 = "Standard_D12_v2" + STANDARD_D13_V2 = "Standard_D13_v2" + STANDARD_D14_V2 = "Standard_D14_v2" + STANDARD_D15_V2 = "Standard_D15_v2" + STANDARD_DS1 = "Standard_DS1" + STANDARD_DS2 = "Standard_DS2" + STANDARD_DS3 = "Standard_DS3" + STANDARD_DS4 = "Standard_DS4" + STANDARD_DS11 = "Standard_DS11" + STANDARD_DS12 = "Standard_DS12" + STANDARD_DS13 = "Standard_DS13" + STANDARD_DS14 = "Standard_DS14" + STANDARD_DS1_V2 = "Standard_DS1_v2" + STANDARD_DS2_V2 = "Standard_DS2_v2" + STANDARD_DS3_V2 = "Standard_DS3_v2" + STANDARD_DS4_V2 = "Standard_DS4_v2" + STANDARD_DS5_V2 = "Standard_DS5_v2" + STANDARD_DS11_V2 = "Standard_DS11_v2" + STANDARD_DS12_V2 = "Standard_DS12_v2" + STANDARD_DS13_V2 = "Standard_DS13_v2" + STANDARD_DS14_V2 = "Standard_DS14_v2" + STANDARD_DS15_V2 = "Standard_DS15_v2" + STANDARD_DS13_4_V2 = "Standard_DS13-4_v2" + STANDARD_DS13_2_V2 = "Standard_DS13-2_v2" + STANDARD_DS14_8_V2 = "Standard_DS14-8_v2" + STANDARD_DS14_4_V2 = "Standard_DS14-4_v2" + STANDARD_E2_V3 = "Standard_E2_v3" + STANDARD_E4_V3 = "Standard_E4_v3" + STANDARD_E8_V3 = "Standard_E8_v3" + STANDARD_E16_V3 = "Standard_E16_v3" + STANDARD_E32_V3 = "Standard_E32_v3" + STANDARD_E64_V3 = "Standard_E64_v3" + STANDARD_E2_S_V3 = "Standard_E2s_v3" + STANDARD_E4_S_V3 = "Standard_E4s_v3" + STANDARD_E8_S_V3 = "Standard_E8s_v3" + STANDARD_E16_S_V3 = "Standard_E16s_v3" + STANDARD_E32_S_V3 = "Standard_E32s_v3" + STANDARD_E64_S_V3 = "Standard_E64s_v3" + STANDARD_E32_16_V3 = "Standard_E32-16_v3" + STANDARD_E32_8_S_V3 = "Standard_E32-8s_v3" + STANDARD_E64_32_S_V3 = "Standard_E64-32s_v3" + STANDARD_E64_16_S_V3 = "Standard_E64-16s_v3" + STANDARD_F1 = "Standard_F1" + STANDARD_F2 = "Standard_F2" + STANDARD_F4 = "Standard_F4" + STANDARD_F8 = "Standard_F8" + STANDARD_F16 = "Standard_F16" + STANDARD_F1_S = "Standard_F1s" + STANDARD_F2_S = "Standard_F2s" + STANDARD_F4_S = "Standard_F4s" + STANDARD_F8_S = "Standard_F8s" + STANDARD_F16_S = "Standard_F16s" + STANDARD_F2_S_V2 = "Standard_F2s_v2" + STANDARD_F4_S_V2 = "Standard_F4s_v2" + STANDARD_F8_S_V2 = "Standard_F8s_v2" + STANDARD_F16_S_V2 = "Standard_F16s_v2" + STANDARD_F32_S_V2 = "Standard_F32s_v2" + STANDARD_F64_S_V2 = "Standard_F64s_v2" + STANDARD_F72_S_V2 = "Standard_F72s_v2" + STANDARD_G1 = "Standard_G1" + STANDARD_G2 = "Standard_G2" + STANDARD_G3 = "Standard_G3" + STANDARD_G4 = "Standard_G4" + STANDARD_G5 = "Standard_G5" + STANDARD_GS1 = "Standard_GS1" + STANDARD_GS2 = "Standard_GS2" + STANDARD_GS3 = "Standard_GS3" + STANDARD_GS4 = "Standard_GS4" + STANDARD_GS5 = "Standard_GS5" + STANDARD_GS4_8 = "Standard_GS4-8" + STANDARD_GS4_4 = "Standard_GS4-4" + STANDARD_GS5_16 = "Standard_GS5-16" + STANDARD_GS5_8 = "Standard_GS5-8" + STANDARD_H8 = "Standard_H8" + STANDARD_H16 = "Standard_H16" + STANDARD_H8_M = "Standard_H8m" + STANDARD_H16_M = "Standard_H16m" + STANDARD_H16_R = "Standard_H16r" + STANDARD_H16_MR = "Standard_H16mr" + STANDARD_L4_S = "Standard_L4s" + STANDARD_L8_S = "Standard_L8s" + STANDARD_L16_S = "Standard_L16s" + STANDARD_L32_S = "Standard_L32s" + STANDARD_M64_S = "Standard_M64s" + STANDARD_M64_MS = "Standard_M64ms" + STANDARD_M128_S = "Standard_M128s" + STANDARD_M128_MS = "Standard_M128ms" + STANDARD_M64_32_MS = "Standard_M64-32ms" + STANDARD_M64_16_MS = "Standard_M64-16ms" + STANDARD_M128_64_MS = "Standard_M128-64ms" + STANDARD_M128_32_MS = "Standard_M128-32ms" + STANDARD_NC6 = "Standard_NC6" + STANDARD_NC12 = "Standard_NC12" + STANDARD_NC24 = "Standard_NC24" + STANDARD_NC24_R = "Standard_NC24r" + STANDARD_NC6_S_V2 = "Standard_NC6s_v2" + STANDARD_NC12_S_V2 = "Standard_NC12s_v2" + STANDARD_NC24_S_V2 = "Standard_NC24s_v2" + STANDARD_NC24_RS_V2 = "Standard_NC24rs_v2" + STANDARD_NC6_S_V3 = "Standard_NC6s_v3" + STANDARD_NC12_S_V3 = "Standard_NC12s_v3" + STANDARD_NC24_S_V3 = "Standard_NC24s_v3" + STANDARD_NC24_RS_V3 = "Standard_NC24rs_v3" + STANDARD_ND6_S = "Standard_ND6s" + STANDARD_ND12_S = "Standard_ND12s" + STANDARD_ND24_S = "Standard_ND24s" + STANDARD_ND24_RS = "Standard_ND24rs" + STANDARD_NV6 = "Standard_NV6" + STANDARD_NV12 = "Standard_NV12" + STANDARD_NV24 = "Standard_NV24" + +class VmDiskTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """VM disk types which are disallowed. + """ + + NONE = "None" + UNMANAGED = "Unmanaged" + +class VMGuestPatchClassificationLinux(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + CRITICAL = "Critical" + SECURITY = "Security" + OTHER = "Other" + +class VMGuestPatchClassificationWindows(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + CRITICAL = "Critical" + SECURITY = "Security" + UPDATE_ROLL_UP = "UpdateRollUp" + FEATURE_PACK = "FeaturePack" + SERVICE_PACK = "ServicePack" + DEFINITION = "Definition" + TOOLS = "Tools" + UPDATES = "Updates" + +class VMGuestPatchRebootBehavior(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Describes the reboot requirements of the patch. + """ + + UNKNOWN = "Unknown" + NEVER_REBOOTS = "NeverReboots" + ALWAYS_REQUIRES_REBOOT = "AlwaysRequiresReboot" + CAN_REQUEST_REBOOT = "CanRequestReboot" + +class VMGuestPatchRebootSetting(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Defines when it is acceptable to reboot a VM during a software update operation. + """ + + IF_REQUIRED = "IfRequired" + NEVER = "Never" + ALWAYS = "Always" + +class VMGuestPatchRebootStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The reboot state of the VM following completion of the operation. + """ + + UNKNOWN = "Unknown" + NOT_NEEDED = "NotNeeded" + REQUIRED = "Required" + STARTED = "Started" + FAILED = "Failed" + COMPLETED = "Completed" + +class WindowsVMGuestPatchMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the mode of VM Guest Patching to IaaS virtual machine.:code:`
`:code:`
` + Possible values are::code:`
`:code:`
` **Manual** - You control the application of + patches to a virtual machine. You do this by applying patches manually inside the VM. In this + mode, automatic updates are disabled; the property WindowsConfiguration.enableAutomaticUpdates + must be false:code:`
`:code:`
` **AutomaticByOS** - The virtual machine will + automatically be updated by the OS. The property WindowsConfiguration.enableAutomaticUpdates + must be true. :code:`
`:code:`
` **AutomaticByPlatform** - the virtual machine will + automatically updated by the platform. The properties provisionVMAgent and + WindowsConfiguration.enableAutomaticUpdates must be true + """ + + MANUAL = "Manual" + AUTOMATIC_BY_OS = "AutomaticByOS" + AUTOMATIC_BY_PLATFORM = "AutomaticByPlatform" diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/models/_models.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/models/_models.py index f3a67f641fb9e..83fd746d058d4 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/models/_models.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/models/_models.py @@ -9,6 +9,93 @@ import msrest.serialization +class AdditionalCapabilities(msrest.serialization.Model): + """Enables or disables a capability on the virtual machine or virtual machine scale set. + + :param ultra_ssd_enabled: The flag that enables or disables a capability to have one or more + managed data disks with UltraSSD_LRS storage account type on the VM or VMSS. Managed disks with + storage account type UltraSSD_LRS can be added to a virtual machine or virtual machine scale + set only if this property is enabled. + :type ultra_ssd_enabled: bool + """ + + _attribute_map = { + 'ultra_ssd_enabled': {'key': 'ultraSSDEnabled', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(AdditionalCapabilities, self).__init__(**kwargs) + self.ultra_ssd_enabled = kwargs.get('ultra_ssd_enabled', None) + + +class AdditionalUnattendContent(msrest.serialization.Model): + """Specifies additional XML formatted information that can be included in the Unattend.xml file, which is used by Windows Setup. Contents are defined by setting name, component name, and the pass in which the content is applied. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar pass_name: The pass name. Currently, the only allowable value is OobeSystem. Default + value: "OobeSystem". + :vartype pass_name: str + :ivar component_name: The component name. Currently, the only allowable value is Microsoft- + Windows-Shell-Setup. Default value: "Microsoft-Windows-Shell-Setup". + :vartype component_name: str + :param setting_name: Specifies the name of the setting to which the content applies. Possible + values are: FirstLogonCommands and AutoLogon. Possible values include: "AutoLogon", + "FirstLogonCommands". + :type setting_name: str or ~azure.mgmt.compute.v2021_03_01.models.SettingNames + :param content: Specifies the XML formatted content that is added to the unattend.xml file for + the specified path and component. The XML must be less than 4KB and must include the root + element for the setting or feature that is being inserted. + :type content: str + """ + + _validation = { + 'pass_name': {'constant': True}, + 'component_name': {'constant': True}, + } + + _attribute_map = { + 'pass_name': {'key': 'passName', 'type': 'str'}, + 'component_name': {'key': 'componentName', 'type': 'str'}, + 'setting_name': {'key': 'settingName', 'type': 'str'}, + 'content': {'key': 'content', 'type': 'str'}, + } + + pass_name = "OobeSystem" + component_name = "Microsoft-Windows-Shell-Setup" + + def __init__( + self, + **kwargs + ): + super(AdditionalUnattendContent, self).__init__(**kwargs) + self.setting_name = kwargs.get('setting_name', None) + self.content = kwargs.get('content', None) + + +class ApiEntityReference(msrest.serialization.Model): + """The API entity reference. + + :param id: The ARM resource id in the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ApiEntityReference, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + class ApiError(msrest.serialization.Model): """Api error. @@ -71,8 +158,91 @@ def __init__( self.target = kwargs.get('target', None) -class CloudService(msrest.serialization.Model): - """Describes the cloud service. +class AutomaticOSUpgradePolicy(msrest.serialization.Model): + """The configuration parameters used for performing automatic OS upgrade. + + :param enable_automatic_os_upgrade: Indicates whether OS upgrades should automatically be + applied to scale set instances in a rolling fashion when a newer version of the OS image + becomes available. Default value is false. :code:`
`:code:`
` If this is set to true for + Windows based scale sets, `enableAutomaticUpdates + `_ is automatically set to false and cannot be set to true. + :type enable_automatic_os_upgrade: bool + :param disable_automatic_rollback: Whether OS image rollback feature should be disabled. + Default value is false. + :type disable_automatic_rollback: bool + """ + + _attribute_map = { + 'enable_automatic_os_upgrade': {'key': 'enableAutomaticOSUpgrade', 'type': 'bool'}, + 'disable_automatic_rollback': {'key': 'disableAutomaticRollback', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(AutomaticOSUpgradePolicy, self).__init__(**kwargs) + self.enable_automatic_os_upgrade = kwargs.get('enable_automatic_os_upgrade', None) + self.disable_automatic_rollback = kwargs.get('disable_automatic_rollback', None) + + +class AutomaticOSUpgradeProperties(msrest.serialization.Model): + """Describes automatic OS upgrade properties on the image. + + All required parameters must be populated in order to send to Azure. + + :param automatic_os_upgrade_supported: Required. Specifies whether automatic OS upgrade is + supported on the image. + :type automatic_os_upgrade_supported: bool + """ + + _validation = { + 'automatic_os_upgrade_supported': {'required': True}, + } + + _attribute_map = { + 'automatic_os_upgrade_supported': {'key': 'automaticOSUpgradeSupported', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(AutomaticOSUpgradeProperties, self).__init__(**kwargs) + self.automatic_os_upgrade_supported = kwargs['automatic_os_upgrade_supported'] + + +class AutomaticRepairsPolicy(msrest.serialization.Model): + """Specifies the configuration parameters for automatic repairs on the virtual machine scale set. + + :param enabled: Specifies whether automatic repairs should be enabled on the virtual machine + scale set. The default value is false. + :type enabled: bool + :param grace_period: The amount of time for which automatic repairs are suspended due to a + state change on VM. The grace time starts after the state change has completed. This helps + avoid premature or accidental repairs. The time duration should be specified in ISO 8601 + format. The minimum allowed grace period is 30 minutes (PT30M), which is also the default + value. The maximum allowed grace period is 90 minutes (PT90M). + :type grace_period: str + """ + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'grace_period': {'key': 'gracePeriod', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AutomaticRepairsPolicy, self).__init__(**kwargs) + self.enabled = kwargs.get('enabled', None) + self.grace_period = kwargs.get('grace_period', None) + + +class Resource(msrest.serialization.Model): + """The Resource model definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -88,8 +258,6 @@ class CloudService(msrest.serialization.Model): :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param properties: Cloud service properties. - :type properties: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceProperties """ _validation = { @@ -105,193 +273,574 @@ class CloudService(msrest.serialization.Model): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'CloudServiceProperties'}, } def __init__( self, **kwargs ): - super(CloudService, self).__init__(**kwargs) + super(Resource, self).__init__(**kwargs) self.id = None self.name = None self.type = None self.location = kwargs['location'] self.tags = kwargs.get('tags', None) - self.properties = kwargs.get('properties', None) -class CloudServiceExtensionProfile(msrest.serialization.Model): - """Describes a cloud service extension profile. +class AvailabilitySet(Resource): + """Specifies information about the availability set that the virtual machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see `Manage the availability of virtual machines `_. :code:`
`:code:`
` For more information on Azure planned maintenance, see `Planned maintenance for virtual machines in Azure `_ :code:`
`:code:`
` Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. - :param extensions: List of extensions for the cloud service. - :type extensions: list[~azure.mgmt.compute.v2021_03_01.models.Extension] + 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 id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: Sku of the availability set, only name is required to be set. See + AvailabilitySetSkuTypes for possible set of values. Use 'Aligned' for virtual machines with + managed disks and 'Classic' for virtual machines with unmanaged disks. Default value is + 'Classic'. + :type sku: ~azure.mgmt.compute.v2021_03_01.models.Sku + :param platform_update_domain_count: Update Domain count. + :type platform_update_domain_count: int + :param platform_fault_domain_count: Fault Domain count. + :type platform_fault_domain_count: int + :param virtual_machines: A list of references to all virtual machines in the availability set. + :type virtual_machines: list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + :param proximity_placement_group: Specifies information about the proximity placement group + that the availability set should be assigned to. :code:`
`:code:`
`Minimum api-version: + 2018-04-01. + :type proximity_placement_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'statuses': {'readonly': True}, + } + _attribute_map = { - 'extensions': {'key': 'extensions', 'type': '[Extension]'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'platform_update_domain_count': {'key': 'properties.platformUpdateDomainCount', 'type': 'int'}, + 'platform_fault_domain_count': {'key': 'properties.platformFaultDomainCount', 'type': 'int'}, + 'virtual_machines': {'key': 'properties.virtualMachines', 'type': '[SubResource]'}, + 'proximity_placement_group': {'key': 'properties.proximityPlacementGroup', 'type': 'SubResource'}, + 'statuses': {'key': 'properties.statuses', 'type': '[InstanceViewStatus]'}, } def __init__( self, **kwargs ): - super(CloudServiceExtensionProfile, self).__init__(**kwargs) - self.extensions = kwargs.get('extensions', None) + super(AvailabilitySet, self).__init__(**kwargs) + self.sku = kwargs.get('sku', None) + self.platform_update_domain_count = kwargs.get('platform_update_domain_count', None) + self.platform_fault_domain_count = kwargs.get('platform_fault_domain_count', None) + self.virtual_machines = kwargs.get('virtual_machines', None) + self.proximity_placement_group = kwargs.get('proximity_placement_group', None) + self.statuses = None -class CloudServiceExtensionProperties(msrest.serialization.Model): - """Extension Properties. +class AvailabilitySetListResult(msrest.serialization.Model): + """The List Availability Set operation response. - 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. - :param publisher: The name of the extension handler publisher. - :type publisher: str - :param type: Specifies the type of the extension. - :type type: str - :param type_handler_version: Specifies the version of the extension. Specifies the version of - the extension. If this element is not specified or an asterisk (*) is used as the value, the - latest version of the extension is used. If the value is specified with a major version number - and an asterisk as the minor version number (X.), the latest minor version of the specified - major version is selected. If a major version number and a minor version number are specified - (X.Y), the specific extension version is selected. If a version is specified, an auto-upgrade - is performed on the role instance. - :type type_handler_version: str - :param auto_upgrade_minor_version: Explicitly specify whether platform can automatically - upgrade typeHandlerVersion to higher minor versions when they become available. - :type auto_upgrade_minor_version: bool - :param settings: Public settings for the extension. For JSON extensions, this is the JSON - settings for the extension. For XML Extension (like RDP), this is the XML setting for the - extension. - :type settings: str - :param protected_settings: Protected settings for the extension which are encrypted before sent - to the role instance. - :type protected_settings: str - :param protected_settings_from_key_vault: - :type protected_settings_from_key_vault: - ~azure.mgmt.compute.v2021_03_01.models.CloudServiceVaultAndSecretReference - :param force_update_tag: Tag to force apply the provided public and protected settings. - Changing the tag value allows for re-running the extension without changing any of the public - or protected settings. - If forceUpdateTag is not changed, updates to public or protected settings would still be - applied by the handler. - If neither forceUpdateTag nor any of public or protected settings change, extension would flow - to the role instance with the same sequence-number, and - it is up to handler implementation whether to re-run it or not. - :type force_update_tag: str - :ivar provisioning_state: The provisioning state, which only appears in the response. - :vartype provisioning_state: str - :param roles_applied_to: Optional list of roles to apply this extension. If property is not - specified or '*' is specified, extension is applied to all roles in the cloud service. - :type roles_applied_to: list[str] + :param value: Required. The list of availability sets. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.AvailabilitySet] + :param next_link: The URI to fetch the next page of AvailabilitySets. Call ListNext() with this + URI to fetch the next page of AvailabilitySets. + :type next_link: str """ _validation = { - 'provisioning_state': {'readonly': True}, + 'value': {'required': True}, } _attribute_map = { - 'publisher': {'key': 'publisher', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'type_handler_version': {'key': 'typeHandlerVersion', 'type': 'str'}, - 'auto_upgrade_minor_version': {'key': 'autoUpgradeMinorVersion', 'type': 'bool'}, - 'settings': {'key': 'settings', 'type': 'str'}, - 'protected_settings': {'key': 'protectedSettings', 'type': 'str'}, - 'protected_settings_from_key_vault': {'key': 'protectedSettingsFromKeyVault', 'type': 'CloudServiceVaultAndSecretReference'}, - 'force_update_tag': {'key': 'forceUpdateTag', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'roles_applied_to': {'key': 'rolesAppliedTo', 'type': '[str]'}, + 'value': {'key': 'value', 'type': '[AvailabilitySet]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, **kwargs ): - super(CloudServiceExtensionProperties, self).__init__(**kwargs) - self.publisher = kwargs.get('publisher', None) - self.type = kwargs.get('type', None) - self.type_handler_version = kwargs.get('type_handler_version', None) - self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', None) - self.settings = kwargs.get('settings', None) - self.protected_settings = kwargs.get('protected_settings', None) - self.protected_settings_from_key_vault = kwargs.get('protected_settings_from_key_vault', None) - self.force_update_tag = kwargs.get('force_update_tag', None) - self.provisioning_state = None - self.roles_applied_to = kwargs.get('roles_applied_to', None) + super(AvailabilitySetListResult, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = kwargs.get('next_link', None) -class CloudServiceInstanceView(msrest.serialization.Model): - """InstanceView of CloudService as a whole. +class UpdateResource(msrest.serialization.Model): + """The Update Resource model definition. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(UpdateResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + +class AvailabilitySetUpdate(UpdateResource): + """Specifies information about the availability set that the virtual machine should be assigned to. Only tags may be updated. Variables are only populated by the server, and will be ignored when sending a request. - :param role_instance: Instance view statuses. - :type role_instance: ~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatusesSummary - :ivar sdk_version: The version of the SDK that was used to generate the package for the cloud - service. - :vartype sdk_version: str - :ivar private_ids: Specifies a list of unique identifiers generated internally for the cloud - service. :code:`
`:code:`
` NOTE: If you are using Azure Diagnostics extension, this - property can be used as 'DeploymentId' for querying details. - :vartype private_ids: list[str] - :ivar statuses: - :vartype statuses: list[~azure.mgmt.compute.v2021_03_01.models.ResourceInstanceViewStatus] + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: Sku of the availability set. + :type sku: ~azure.mgmt.compute.v2021_03_01.models.Sku + :param platform_update_domain_count: Update Domain count. + :type platform_update_domain_count: int + :param platform_fault_domain_count: Fault Domain count. + :type platform_fault_domain_count: int + :param virtual_machines: A list of references to all virtual machines in the availability set. + :type virtual_machines: list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + :param proximity_placement_group: Specifies information about the proximity placement group + that the availability set should be assigned to. :code:`
`:code:`
`Minimum api-version: + 2018-04-01. + :type proximity_placement_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] """ _validation = { - 'sdk_version': {'readonly': True}, - 'private_ids': {'readonly': True}, 'statuses': {'readonly': True}, } _attribute_map = { - 'role_instance': {'key': 'roleInstance', 'type': 'InstanceViewStatusesSummary'}, - 'sdk_version': {'key': 'sdkVersion', 'type': 'str'}, - 'private_ids': {'key': 'privateIds', 'type': '[str]'}, - 'statuses': {'key': 'statuses', 'type': '[ResourceInstanceViewStatus]'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'platform_update_domain_count': {'key': 'properties.platformUpdateDomainCount', 'type': 'int'}, + 'platform_fault_domain_count': {'key': 'properties.platformFaultDomainCount', 'type': 'int'}, + 'virtual_machines': {'key': 'properties.virtualMachines', 'type': '[SubResource]'}, + 'proximity_placement_group': {'key': 'properties.proximityPlacementGroup', 'type': 'SubResource'}, + 'statuses': {'key': 'properties.statuses', 'type': '[InstanceViewStatus]'}, } def __init__( self, **kwargs ): - super(CloudServiceInstanceView, self).__init__(**kwargs) - self.role_instance = kwargs.get('role_instance', None) - self.sdk_version = None - self.private_ids = None + super(AvailabilitySetUpdate, self).__init__(**kwargs) + self.sku = kwargs.get('sku', None) + self.platform_update_domain_count = kwargs.get('platform_update_domain_count', None) + self.platform_fault_domain_count = kwargs.get('platform_fault_domain_count', None) + self.virtual_machines = kwargs.get('virtual_machines', None) + self.proximity_placement_group = kwargs.get('proximity_placement_group', None) self.statuses = None -class CloudServiceListResult(msrest.serialization.Model): - """CloudServiceListResult. +class AvailablePatchSummary(msrest.serialization.Model): + """Describes the properties of an virtual machine instance view for available patch summary. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :param value: Required. - :type value: list[~azure.mgmt.compute.v2021_03_01.models.CloudService] - :param next_link: - :type next_link: str + :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.". Possible values include: "Unknown", "InProgress", "Failed", + "Succeeded", "CompletedWithWarnings". + :vartype status: str or ~azure.mgmt.compute.v2021_03_01.models.PatchOperationStatus + :ivar assessment_activity_id: The activity ID of the operation that produced this result. It is + used to correlate across CRP and extension logs. + :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 critical_and_security_patch_count: The number of critical or security patches that have + been detected as available and not yet installed. + :vartype critical_and_security_patch_count: int + :ivar other_patch_count: The number of all available patches excluding critical and security. + :vartype other_patch_count: int + :ivar start_time: The UTC timestamp when the operation began. + :vartype start_time: ~datetime.datetime + :ivar last_modified_time: The UTC timestamp when the operation began. + :vartype last_modified_time: ~datetime.datetime + :ivar error: The errors that were encountered during execution of the operation. The details + array contains the list of them. + :vartype error: ~azure.mgmt.compute.v2021_03_01.models.ApiError """ _validation = { - 'value': {'required': True}, + 'status': {'readonly': True}, + 'assessment_activity_id': {'readonly': True}, + 'reboot_pending': {'readonly': True}, + 'critical_and_security_patch_count': {'readonly': True}, + 'other_patch_count': {'readonly': True}, + 'start_time': {'readonly': True}, + 'last_modified_time': {'readonly': True}, + 'error': {'readonly': True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[CloudService]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'str'}, + 'assessment_activity_id': {'key': 'assessmentActivityId', 'type': 'str'}, + 'reboot_pending': {'key': 'rebootPending', 'type': 'bool'}, + 'critical_and_security_patch_count': {'key': 'criticalAndSecurityPatchCount', 'type': 'int'}, + 'other_patch_count': {'key': 'otherPatchCount', 'type': 'int'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'last_modified_time': {'key': 'lastModifiedTime', 'type': 'iso-8601'}, + 'error': {'key': 'error', 'type': 'ApiError'}, } def __init__( self, **kwargs ): - super(CloudServiceListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) + super(AvailablePatchSummary, self).__init__(**kwargs) + self.status = None + self.assessment_activity_id = None + self.reboot_pending = None + self.critical_and_security_patch_count = None + self.other_patch_count = None + self.start_time = None + self.last_modified_time = None + self.error = None + + +class BillingProfile(msrest.serialization.Model): + """Specifies the billing related details of a Azure Spot VM or VMSS. :code:`
`:code:`
`Minimum api-version: 2019-03-01. + + :param max_price: Specifies the maximum price you are willing to pay for a Azure Spot VM/VMSS. + This price is in US Dollars. :code:`
`:code:`
` This price will be compared with the + current Azure Spot price for the VM size. Also, the prices are compared at the time of + create/update of Azure Spot VM/VMSS and the operation will only succeed if the maxPrice is + greater than the current Azure Spot price. :code:`
`:code:`
` The maxPrice will also be + used for evicting a Azure Spot VM/VMSS if the current Azure Spot price goes beyond the maxPrice + after creation of VM/VMSS. :code:`
`:code:`
` Possible values are: + :code:`
`:code:`
` - Any decimal value greater than zero. Example: 0.01538 + :code:`
`:code:`
` -1 – indicates default price to be up-to on-demand. + :code:`
`:code:`
` You can set the maxPrice to -1 to indicate that the Azure Spot VM/VMSS + should not be evicted for price reasons. Also, the default max price is -1 if it is not + provided by you. :code:`
`:code:`
`Minimum api-version: 2019-03-01. + :type max_price: float + """ + _attribute_map = { + 'max_price': {'key': 'maxPrice', 'type': 'float'}, + } -class CloudServiceNetworkProfile(msrest.serialization.Model): + def __init__( + self, + **kwargs + ): + super(BillingProfile, self).__init__(**kwargs) + self.max_price = kwargs.get('max_price', None) + + +class BootDiagnostics(msrest.serialization.Model): + """Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. :code:`
`:code:`
` You can easily view the output of your console log. :code:`
`:code:`
` Azure also enables you to see a screenshot of the VM from the hypervisor. + + :param enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :type enabled: bool + :param storage_uri: Uri of the storage account to use for placing the console output and + screenshot. :code:`
`:code:`
`If storageUri is not specified while enabling boot + diagnostics, managed storage will be used. + :type storage_uri: str + """ + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(BootDiagnostics, self).__init__(**kwargs) + self.enabled = kwargs.get('enabled', None) + self.storage_uri = kwargs.get('storage_uri', None) + + +class BootDiagnosticsInstanceView(msrest.serialization.Model): + """The instance view of a virtual machine boot diagnostics. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar console_screenshot_blob_uri: The console screenshot blob URI. + :code:`
`:code:`
`NOTE: This will **not** be set if boot diagnostics is currently enabled + with managed storage. + :vartype console_screenshot_blob_uri: str + :ivar serial_console_log_blob_uri: The serial console log blob Uri. + :code:`
`:code:`
`NOTE: This will **not** be set if boot diagnostics is currently enabled + with managed storage. + :vartype serial_console_log_blob_uri: str + :ivar status: The boot diagnostics status information for the VM. :code:`
`:code:`
` + NOTE: It will be set only if there are errors encountered in enabling boot diagnostics. + :vartype status: ~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus + """ + + _validation = { + 'console_screenshot_blob_uri': {'readonly': True}, + 'serial_console_log_blob_uri': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'console_screenshot_blob_uri': {'key': 'consoleScreenshotBlobUri', 'type': 'str'}, + 'serial_console_log_blob_uri': {'key': 'serialConsoleLogBlobUri', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'InstanceViewStatus'}, + } + + def __init__( + self, + **kwargs + ): + super(BootDiagnosticsInstanceView, self).__init__(**kwargs) + self.console_screenshot_blob_uri = None + self.serial_console_log_blob_uri = None + self.status = None + + +class CloudService(msrest.serialization.Model): + """Describes the cloud service. + + 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 id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param properties: Cloud service properties. + :type properties: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'CloudServiceProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudService, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs['location'] + self.tags = kwargs.get('tags', None) + self.properties = kwargs.get('properties', None) + + +class CloudServiceExtensionProfile(msrest.serialization.Model): + """Describes a cloud service extension profile. + + :param extensions: List of extensions for the cloud service. + :type extensions: list[~azure.mgmt.compute.v2021_03_01.models.Extension] + """ + + _attribute_map = { + 'extensions': {'key': 'extensions', 'type': '[Extension]'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudServiceExtensionProfile, self).__init__(**kwargs) + self.extensions = kwargs.get('extensions', None) + + +class CloudServiceExtensionProperties(msrest.serialization.Model): + """Extension Properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param publisher: The name of the extension handler publisher. + :type publisher: str + :param type: Specifies the type of the extension. + :type type: str + :param type_handler_version: Specifies the version of the extension. Specifies the version of + the extension. If this element is not specified or an asterisk (*) is used as the value, the + latest version of the extension is used. If the value is specified with a major version number + and an asterisk as the minor version number (X.), the latest minor version of the specified + major version is selected. If a major version number and a minor version number are specified + (X.Y), the specific extension version is selected. If a version is specified, an auto-upgrade + is performed on the role instance. + :type type_handler_version: str + :param auto_upgrade_minor_version: Explicitly specify whether platform can automatically + upgrade typeHandlerVersion to higher minor versions when they become available. + :type auto_upgrade_minor_version: bool + :param settings: Public settings for the extension. For JSON extensions, this is the JSON + settings for the extension. For XML Extension (like RDP), this is the XML setting for the + extension. + :type settings: str + :param protected_settings: Protected settings for the extension which are encrypted before sent + to the role instance. + :type protected_settings: str + :param protected_settings_from_key_vault: + :type protected_settings_from_key_vault: + ~azure.mgmt.compute.v2021_03_01.models.CloudServiceVaultAndSecretReference + :param force_update_tag: Tag to force apply the provided public and protected settings. + Changing the tag value allows for re-running the extension without changing any of the public + or protected settings. + If forceUpdateTag is not changed, updates to public or protected settings would still be + applied by the handler. + If neither forceUpdateTag nor any of public or protected settings change, extension would flow + to the role instance with the same sequence-number, and + it is up to handler implementation whether to re-run it or not. + :type force_update_tag: str + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :param roles_applied_to: Optional list of roles to apply this extension. If property is not + specified or '*' is specified, extension is applied to all roles in the cloud service. + :type roles_applied_to: list[str] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'type_handler_version': {'key': 'typeHandlerVersion', 'type': 'str'}, + 'auto_upgrade_minor_version': {'key': 'autoUpgradeMinorVersion', 'type': 'bool'}, + 'settings': {'key': 'settings', 'type': 'str'}, + 'protected_settings': {'key': 'protectedSettings', 'type': 'str'}, + 'protected_settings_from_key_vault': {'key': 'protectedSettingsFromKeyVault', 'type': 'CloudServiceVaultAndSecretReference'}, + 'force_update_tag': {'key': 'forceUpdateTag', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'roles_applied_to': {'key': 'rolesAppliedTo', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudServiceExtensionProperties, self).__init__(**kwargs) + self.publisher = kwargs.get('publisher', None) + self.type = kwargs.get('type', None) + self.type_handler_version = kwargs.get('type_handler_version', None) + self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', None) + self.settings = kwargs.get('settings', None) + self.protected_settings = kwargs.get('protected_settings', None) + self.protected_settings_from_key_vault = kwargs.get('protected_settings_from_key_vault', None) + self.force_update_tag = kwargs.get('force_update_tag', None) + self.provisioning_state = None + self.roles_applied_to = kwargs.get('roles_applied_to', None) + + +class CloudServiceInstanceView(msrest.serialization.Model): + """InstanceView of CloudService as a whole. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param role_instance: Instance view statuses. + :type role_instance: ~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatusesSummary + :ivar sdk_version: The version of the SDK that was used to generate the package for the cloud + service. + :vartype sdk_version: str + :ivar private_ids: Specifies a list of unique identifiers generated internally for the cloud + service. :code:`
`:code:`
` NOTE: If you are using Azure Diagnostics extension, this + property can be used as 'DeploymentId' for querying details. + :vartype private_ids: list[str] + :ivar statuses: + :vartype statuses: list[~azure.mgmt.compute.v2021_03_01.models.ResourceInstanceViewStatus] + """ + + _validation = { + 'sdk_version': {'readonly': True}, + 'private_ids': {'readonly': True}, + 'statuses': {'readonly': True}, + } + + _attribute_map = { + 'role_instance': {'key': 'roleInstance', 'type': 'InstanceViewStatusesSummary'}, + 'sdk_version': {'key': 'sdkVersion', 'type': 'str'}, + 'private_ids': {'key': 'privateIds', 'type': '[str]'}, + 'statuses': {'key': 'statuses', 'type': '[ResourceInstanceViewStatus]'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudServiceInstanceView, self).__init__(**kwargs) + self.role_instance = kwargs.get('role_instance', None) + self.sdk_version = None + self.private_ids = None + self.statuses = None + + +class CloudServiceListResult(msrest.serialization.Model): + """CloudServiceListResult. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.CloudService] + :param next_link: + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CloudService]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudServiceListResult, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = kwargs.get('next_link', None) + + +class CloudServiceNetworkProfile(msrest.serialization.Model): """Network Profile for the cloud service. :param load_balancer_configurations: List of Load balancer configurations. Cloud service can @@ -691,250 +1240,395 @@ def __init__( self.vault_certificates = kwargs.get('vault_certificates', None) -class Extension(msrest.serialization.Model): - """Describes a cloud service Extension. +class ComputeOperationListResult(msrest.serialization.Model): + """The List Compute Operation operation response. - :param name: The name of the extension. - :type name: str - :param properties: Extension Properties. - :type properties: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceExtensionProperties + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of compute operations. + :vartype value: list[~azure.mgmt.compute.v2021_03_01.models.ComputeOperationValue] """ - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'CloudServiceExtensionProperties'}, + _validation = { + 'value': {'readonly': True}, } - def __init__( - self, - **kwargs - ): - super(Extension, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.properties = kwargs.get('properties', None) - - -class InnerError(msrest.serialization.Model): - """Inner error details. - - :param exceptiontype: The exception type. - :type exceptiontype: str - :param errordetail: The internal error message or exception dump. - :type errordetail: str - """ - _attribute_map = { - 'exceptiontype': {'key': 'exceptiontype', 'type': 'str'}, - 'errordetail': {'key': 'errordetail', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[ComputeOperationValue]'}, } def __init__( self, **kwargs ): - super(InnerError, self).__init__(**kwargs) - self.exceptiontype = kwargs.get('exceptiontype', None) - self.errordetail = kwargs.get('errordetail', None) + super(ComputeOperationListResult, self).__init__(**kwargs) + self.value = None -class InstanceSku(msrest.serialization.Model): - """InstanceSku. +class ComputeOperationValue(msrest.serialization.Model): + """Describes the properties of a Compute Operation value. Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: The sku name. + :ivar origin: The origin of the compute operation. + :vartype origin: str + :ivar name: The name of the compute operation. :vartype name: str - :ivar tier: The tier of the cloud service role instance. - :vartype tier: str + :ivar operation: The display name of the compute operation. + :vartype operation: str + :ivar resource: The display name of the resource the operation applies to. + :vartype resource: str + :ivar description: The description of the operation. + :vartype description: str + :ivar provider: The resource provider for the operation. + :vartype provider: str """ _validation = { + 'origin': {'readonly': True}, 'name': {'readonly': True}, - 'tier': {'readonly': True}, + 'operation': {'readonly': True}, + 'resource': {'readonly': True}, + 'description': {'readonly': True}, + 'provider': {'readonly': True}, } _attribute_map = { + 'origin': {'key': 'origin', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, + 'operation': {'key': 'display.operation', 'type': 'str'}, + 'resource': {'key': 'display.resource', 'type': 'str'}, + 'description': {'key': 'display.description', 'type': 'str'}, + 'provider': {'key': 'display.provider', 'type': 'str'}, } def __init__( self, **kwargs ): - super(InstanceSku, self).__init__(**kwargs) + super(ComputeOperationValue, self).__init__(**kwargs) + self.origin = None self.name = None - self.tier = None + self.operation = None + self.resource = None + self.description = None + self.provider = None -class InstanceViewStatusesSummary(msrest.serialization.Model): - """Instance view statuses. +class DataDisk(msrest.serialization.Model): + """Describes a data disk. Variables are only populated by the server, and will be ignored when sending a request. - :ivar statuses_summary: - :vartype statuses_summary: list[~azure.mgmt.compute.v2021_03_01.models.StatusCodeCount] + All required parameters must be populated in order to send to Azure. + + :param lun: Required. Specifies the logical unit number of the data disk. This value is used to + identify data disks within the VM and therefore must be unique for each data disk attached to a + VM. + :type lun: int + :param name: The disk name. + :type name: str + :param vhd: The virtual hard disk. + :type vhd: ~azure.mgmt.compute.v2021_03_01.models.VirtualHardDisk + :param image: The source user image virtual hard disk. The virtual hard disk will be copied + before being attached to the virtual machine. If SourceImage is provided, the destination + virtual hard drive must not exist. + :type image: ~azure.mgmt.compute.v2021_03_01.models.VirtualHardDisk + :param caching: Specifies the caching requirements. :code:`
`:code:`
` Possible values + are: :code:`
`:code:`
` **None** :code:`
`:code:`
` **ReadOnly** + :code:`
`:code:`
` **ReadWrite** :code:`
`:code:`
` Default: **None for Standard + storage. ReadOnly for Premium storage**. Possible values include: "None", "ReadOnly", + "ReadWrite". + :type caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes + :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :type write_accelerator_enabled: bool + :param create_option: Required. Specifies how the virtual machine should be + created.:code:`
`:code:`
` Possible values are::code:`
`:code:`
` **Attach** \u2013 + This value is used when you are using a specialized disk to create the virtual + machine.:code:`
`:code:`
` **FromImage** \u2013 This value is used when you are using an + image to create the virtual machine. If you are using a platform image, you also use the + imageReference element described above. If you are using a marketplace image, you also use the + plan element previously described. Possible values include: "FromImage", "Empty", "Attach". + :type create_option: str or ~azure.mgmt.compute.v2021_03_01.models.DiskCreateOptionTypes + :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + used to overwrite the size of the disk in a virtual machine image. :code:`
`:code:`
` + This value cannot be larger than 1023 GB. + :type disk_size_gb: int + :param managed_disk: The managed disk parameters. + :type managed_disk: ~azure.mgmt.compute.v2021_03_01.models.ManagedDiskParameters + :param to_be_detached: Specifies whether the data disk is in process of detachment from the + VirtualMachine/VirtualMachineScaleset. + :type to_be_detached: bool + :ivar disk_iops_read_write: Specifies the Read-Write IOPS for the managed disk when + StorageAccountType is UltraSSD_LRS. Returned only for VirtualMachine ScaleSet VM disks. Can be + updated only via updates to the VirtualMachine Scale Set. + :vartype disk_iops_read_write: long + :ivar disk_m_bps_read_write: Specifies the bandwidth in MB per second for the managed disk when + StorageAccountType is UltraSSD_LRS. Returned only for VirtualMachine ScaleSet VM disks. Can be + updated only via updates to the VirtualMachine Scale Set. + :vartype disk_m_bps_read_write: long + :param detach_option: Specifies the detach behavior to be used while detaching a disk or which + is already in the process of detachment from the virtual machine. Supported values: + **ForceDetach**. :code:`
`:code:`
` detachOption: **ForceDetach** is applicable only for + managed data disks. If a previous detachment attempt of the data disk did not complete due to + an unexpected failure from the virtual machine and the disk is still not released then use + force-detach as a last resort option to detach the disk forcibly from the VM. All writes might + not have been flushed when using this detach behavior. :code:`
`:code:`
` This feature is + still in preview mode and is not supported for VirtualMachineScaleSet. To force-detach a data + disk update toBeDetached to 'true' along with setting detachOption: 'ForceDetach'. Possible + values include: "ForceDetach". + :type detach_option: str or ~azure.mgmt.compute.v2021_03_01.models.DiskDetachOptionTypes """ _validation = { - 'statuses_summary': {'readonly': True}, + 'lun': {'required': True}, + 'create_option': {'required': True}, + 'disk_iops_read_write': {'readonly': True}, + 'disk_m_bps_read_write': {'readonly': True}, } _attribute_map = { - 'statuses_summary': {'key': 'statusesSummary', 'type': '[StatusCodeCount]'}, + 'lun': {'key': 'lun', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'vhd': {'key': 'vhd', 'type': 'VirtualHardDisk'}, + 'image': {'key': 'image', 'type': 'VirtualHardDisk'}, + 'caching': {'key': 'caching', 'type': 'str'}, + 'write_accelerator_enabled': {'key': 'writeAcceleratorEnabled', 'type': 'bool'}, + 'create_option': {'key': 'createOption', 'type': 'str'}, + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, + 'managed_disk': {'key': 'managedDisk', 'type': 'ManagedDiskParameters'}, + 'to_be_detached': {'key': 'toBeDetached', 'type': 'bool'}, + 'disk_iops_read_write': {'key': 'diskIOPSReadWrite', 'type': 'long'}, + 'disk_m_bps_read_write': {'key': 'diskMBpsReadWrite', 'type': 'long'}, + 'detach_option': {'key': 'detachOption', 'type': 'str'}, } def __init__( self, **kwargs ): - super(InstanceViewStatusesSummary, self).__init__(**kwargs) - self.statuses_summary = None - - -class LoadBalancerConfiguration(msrest.serialization.Model): - """Describes the load balancer configuration. + super(DataDisk, self).__init__(**kwargs) + self.lun = kwargs['lun'] + self.name = kwargs.get('name', None) + self.vhd = kwargs.get('vhd', None) + self.image = kwargs.get('image', None) + self.caching = kwargs.get('caching', None) + self.write_accelerator_enabled = kwargs.get('write_accelerator_enabled', None) + self.create_option = kwargs['create_option'] + self.disk_size_gb = kwargs.get('disk_size_gb', None) + self.managed_disk = kwargs.get('managed_disk', None) + self.to_be_detached = kwargs.get('to_be_detached', None) + self.disk_iops_read_write = None + self.disk_m_bps_read_write = None + self.detach_option = kwargs.get('detach_option', None) + + +class DataDiskImage(msrest.serialization.Model): + """Contains the data disk images information. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :param id: Resource Id. - :type id: str - :param name: Required. The name of the Load balancer. - :type name: str - :param properties: Required. Properties of the load balancer configuration. - :type properties: ~azure.mgmt.compute.v2021_03_01.models.LoadBalancerConfigurationProperties + :ivar lun: Specifies the logical unit number of the data disk. This value is used to identify + data disks within the VM and therefore must be unique for each data disk attached to a VM. + :vartype lun: int """ _validation = { - 'name': {'required': True}, - 'properties': {'required': True}, + 'lun': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'LoadBalancerConfigurationProperties'}, + 'lun': {'key': 'lun', 'type': 'int'}, } def __init__( self, **kwargs ): - super(LoadBalancerConfiguration, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.name = kwargs['name'] - self.properties = kwargs['properties'] + super(DataDiskImage, self).__init__(**kwargs) + self.lun = None -class LoadBalancerConfigurationProperties(msrest.serialization.Model): - """LoadBalancerConfigurationProperties. +class DedicatedHost(Resource): + """Specifies information about the Dedicated host. + + 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. - :param frontend_ip_configurations: Required. Specifies the frontend IP to be used for the load - balancer. Only IPv4 frontend IP address is supported. Each load balancer configuration must - have exactly one frontend IP configuration. - :type frontend_ip_configurations: - list[~azure.mgmt.compute.v2021_03_01.models.LoadBalancerFrontendIPConfiguration] + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: Required. SKU of the dedicated host for Hardware Generation and VM family. Only + name is required to be set. List Microsoft.Compute SKUs for a list of possible values. + :type sku: ~azure.mgmt.compute.v2021_03_01.models.Sku + :param platform_fault_domain: Fault domain of the dedicated host within a dedicated host group. + :type platform_fault_domain: int + :param auto_replace_on_failure: Specifies whether the dedicated host should be replaced + automatically in case of a failure. The value is defaulted to 'true' when not provided. + :type auto_replace_on_failure: bool + :ivar host_id: A unique id generated and assigned to the dedicated host by the platform. + :code:`
`:code:`
` Does not change throughout the lifetime of the host. + :vartype host_id: str + :ivar virtual_machines: A list of references to all virtual machines in the Dedicated Host. + :vartype virtual_machines: list[~azure.mgmt.compute.v2021_03_01.models.SubResourceReadOnly] + :param license_type: Specifies the software license type that will be applied to the VMs + deployed on the dedicated host. :code:`
`:code:`
` Possible values are: + :code:`
`:code:`
` **None** :code:`
`:code:`
` **Windows_Server_Hybrid** + :code:`
`:code:`
` **Windows_Server_Perpetual** :code:`
`:code:`
` Default: + **None**. Possible values include: "None", "Windows_Server_Hybrid", "Windows_Server_Perpetual". + :type license_type: str or ~azure.mgmt.compute.v2021_03_01.models.DedicatedHostLicenseTypes + :ivar provisioning_time: The date when the host was first provisioned. + :vartype provisioning_time: ~datetime.datetime + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :ivar instance_view: The dedicated host instance view. + :vartype instance_view: ~azure.mgmt.compute.v2021_03_01.models.DedicatedHostInstanceView """ _validation = { - 'frontend_ip_configurations': {'required': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'sku': {'required': True}, + 'platform_fault_domain': {'minimum': 0}, + 'host_id': {'readonly': True}, + 'virtual_machines': {'readonly': True}, + 'provisioning_time': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'instance_view': {'readonly': True}, } _attribute_map = { - 'frontend_ip_configurations': {'key': 'frontendIPConfigurations', 'type': '[LoadBalancerFrontendIPConfiguration]'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'platform_fault_domain': {'key': 'properties.platformFaultDomain', 'type': 'int'}, + 'auto_replace_on_failure': {'key': 'properties.autoReplaceOnFailure', 'type': 'bool'}, + 'host_id': {'key': 'properties.hostId', 'type': 'str'}, + 'virtual_machines': {'key': 'properties.virtualMachines', 'type': '[SubResourceReadOnly]'}, + 'license_type': {'key': 'properties.licenseType', 'type': 'str'}, + 'provisioning_time': {'key': 'properties.provisioningTime', 'type': 'iso-8601'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'instance_view': {'key': 'properties.instanceView', 'type': 'DedicatedHostInstanceView'}, } def __init__( self, **kwargs ): - super(LoadBalancerConfigurationProperties, self).__init__(**kwargs) - self.frontend_ip_configurations = kwargs['frontend_ip_configurations'] - + super(DedicatedHost, self).__init__(**kwargs) + self.sku = kwargs['sku'] + self.platform_fault_domain = kwargs.get('platform_fault_domain', None) + self.auto_replace_on_failure = kwargs.get('auto_replace_on_failure', None) + self.host_id = None + self.virtual_machines = None + self.license_type = kwargs.get('license_type', None) + self.provisioning_time = None + self.provisioning_state = None + self.instance_view = None -class LoadBalancerFrontendIPConfiguration(msrest.serialization.Model): - """LoadBalancerFrontendIPConfiguration. - All required parameters must be populated in order to send to Azure. +class DedicatedHostAllocatableVM(msrest.serialization.Model): + """Represents the dedicated host unutilized capacity in terms of a specific VM size. - :param name: Required. The name of the resource that is unique within the set of frontend IP - configurations used by the load balancer. This name can be used to access the resource. - :type name: str - :param properties: Required. Properties of load balancer frontend ip configuration. - :type properties: - ~azure.mgmt.compute.v2021_03_01.models.LoadBalancerFrontendIPConfigurationProperties + :param vm_size: VM size in terms of which the unutilized capacity is represented. + :type vm_size: str + :param count: Maximum number of VMs of size vmSize that can fit in the dedicated host's + remaining capacity. + :type count: float """ - _validation = { - 'name': {'required': True}, - 'properties': {'required': True}, - } - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'LoadBalancerFrontendIPConfigurationProperties'}, + 'vm_size': {'key': 'vmSize', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'float'}, } def __init__( self, **kwargs ): - super(LoadBalancerFrontendIPConfiguration, self).__init__(**kwargs) - self.name = kwargs['name'] - self.properties = kwargs['properties'] + super(DedicatedHostAllocatableVM, self).__init__(**kwargs) + self.vm_size = kwargs.get('vm_size', None) + self.count = kwargs.get('count', None) -class LoadBalancerFrontendIPConfigurationProperties(msrest.serialization.Model): - """Describes a cloud service IP Configuration. +class DedicatedHostAvailableCapacity(msrest.serialization.Model): + """Dedicated host unutilized capacity. - :param public_ip_address: The reference to the public ip address resource. - :type public_ip_address: ~azure.mgmt.compute.v2021_03_01.models.SubResource - :param subnet: The reference to the virtual network subnet resource. - :type subnet: ~azure.mgmt.compute.v2021_03_01.models.SubResource - :param private_ip_address: The virtual network private IP address of the IP configuration. - :type private_ip_address: str + :param allocatable_v_ms: The unutilized capacity of the dedicated host represented in terms of + each VM size that is allowed to be deployed to the dedicated host. + :type allocatable_v_ms: list[~azure.mgmt.compute.v2021_03_01.models.DedicatedHostAllocatableVM] """ _attribute_map = { - 'public_ip_address': {'key': 'publicIPAddress', 'type': 'SubResource'}, - 'subnet': {'key': 'subnet', 'type': 'SubResource'}, - 'private_ip_address': {'key': 'privateIPAddress', 'type': 'str'}, + 'allocatable_v_ms': {'key': 'allocatableVMs', 'type': '[DedicatedHostAllocatableVM]'}, } def __init__( self, **kwargs ): - super(LoadBalancerFrontendIPConfigurationProperties, self).__init__(**kwargs) - self.public_ip_address = kwargs.get('public_ip_address', None) - self.subnet = kwargs.get('subnet', None) - self.private_ip_address = kwargs.get('private_ip_address', None) + super(DedicatedHostAvailableCapacity, self).__init__(**kwargs) + self.allocatable_v_ms = kwargs.get('allocatable_v_ms', None) -class OSFamily(msrest.serialization.Model): - """Describes a cloud service OS family. +class DedicatedHostGroup(Resource): + """Specifies information about the dedicated host group that the dedicated hosts should be assigned to. :code:`
`:code:`
` Currently, a dedicated host can only be added to a dedicated host group at creation time. An existing dedicated host cannot be added to another dedicated host group. 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 id: Resource Id. :vartype id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Resource location. - :vartype location: str - :param properties: OS family properties. - :type properties: ~azure.mgmt.compute.v2021_03_01.models.OSFamilyProperties + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param zones: Availability Zone to use for this host group. Only single zone is supported. The + zone can be assigned only during creation. If not provided, the group supports all zones in the + region. If provided, enforces each host in the group to be in the same zone. + :type zones: list[str] + :param platform_fault_domain_count: Number of fault domains that the host group can span. + :type platform_fault_domain_count: int + :ivar hosts: A list of references to all dedicated hosts in the dedicated host group. + :vartype hosts: list[~azure.mgmt.compute.v2021_03_01.models.SubResourceReadOnly] + :ivar instance_view: The dedicated host group instance view, which has the list of instance + view of the dedicated hosts under the dedicated host group. + :vartype instance_view: ~azure.mgmt.compute.v2021_03_01.models.DedicatedHostGroupInstanceView + :param support_automatic_placement: Specifies whether virtual machines or virtual machine scale + sets can be placed automatically on the dedicated host group. Automatic placement means + resources are allocated on dedicated hosts, that are chosen by Azure, under the dedicated host + group. The value is defaulted to 'false' when not provided. :code:`
`:code:`
`Minimum + api-version: 2020-06-01. + :type support_automatic_placement: bool """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'location': {'readonly': True}, + 'location': {'required': True}, + 'platform_fault_domain_count': {'minimum': 1}, + 'hosts': {'readonly': True}, + 'instance_view': {'readonly': True}, } _attribute_map = { @@ -942,29 +1636,54 @@ class OSFamily(msrest.serialization.Model): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'OSFamilyProperties'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'zones': {'key': 'zones', 'type': '[str]'}, + 'platform_fault_domain_count': {'key': 'properties.platformFaultDomainCount', 'type': 'int'}, + 'hosts': {'key': 'properties.hosts', 'type': '[SubResourceReadOnly]'}, + 'instance_view': {'key': 'properties.instanceView', 'type': 'DedicatedHostGroupInstanceView'}, + 'support_automatic_placement': {'key': 'properties.supportAutomaticPlacement', 'type': 'bool'}, } def __init__( self, **kwargs ): - super(OSFamily, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = None - self.properties = kwargs.get('properties', None) + super(DedicatedHostGroup, self).__init__(**kwargs) + self.zones = kwargs.get('zones', None) + self.platform_fault_domain_count = kwargs.get('platform_fault_domain_count', None) + self.hosts = None + self.instance_view = None + self.support_automatic_placement = kwargs.get('support_automatic_placement', None) -class OSFamilyListResult(msrest.serialization.Model): - """OSFamilyListResult. +class DedicatedHostGroupInstanceView(msrest.serialization.Model): + """DedicatedHostGroupInstanceView. + + :param hosts: List of instance view of the dedicated hosts under the dedicated host group. + :type hosts: list[~azure.mgmt.compute.v2021_03_01.models.DedicatedHostInstanceViewWithName] + """ + + _attribute_map = { + 'hosts': {'key': 'hosts', 'type': '[DedicatedHostInstanceViewWithName]'}, + } + + def __init__( + self, + **kwargs + ): + super(DedicatedHostGroupInstanceView, self).__init__(**kwargs) + self.hosts = kwargs.get('hosts', None) + + +class DedicatedHostGroupListResult(msrest.serialization.Model): + """The List Dedicated Host Group with resource group response. All required parameters must be populated in order to send to Azure. - :param value: Required. - :type value: list[~azure.mgmt.compute.v2021_03_01.models.OSFamily] - :param next_link: + :param value: Required. The list of dedicated host groups. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.DedicatedHostGroup] + :param next_link: The URI to fetch the next page of Dedicated Host Groups. Call ListNext() with + this URI to fetch the next page of Dedicated Host Groups. :type next_link: str """ @@ -973,7 +1692,7 @@ class OSFamilyListResult(msrest.serialization.Model): } _attribute_map = { - 'value': {'key': 'value', 'type': '[OSFamily]'}, + 'value': {'key': 'value', 'type': '[DedicatedHostGroup]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } @@ -981,117 +1700,2101 @@ def __init__( self, **kwargs ): - super(OSFamilyListResult, self).__init__(**kwargs) + super(DedicatedHostGroupListResult, self).__init__(**kwargs) self.value = kwargs['value'] self.next_link = kwargs.get('next_link', None) -class OSFamilyProperties(msrest.serialization.Model): - """OS family properties. +class DedicatedHostGroupUpdate(UpdateResource): + """Specifies information about the dedicated host group that the dedicated host should be assigned to. Only tags may be updated. Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: The OS family name. - :vartype name: str - :ivar label: The OS family label. - :vartype label: str - :ivar versions: List of OS versions belonging to this family. - :vartype versions: list[~azure.mgmt.compute.v2021_03_01.models.OSVersionPropertiesBase] + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param zones: Availability Zone to use for this host group. Only single zone is supported. The + zone can be assigned only during creation. If not provided, the group supports all zones in the + region. If provided, enforces each host in the group to be in the same zone. + :type zones: list[str] + :param platform_fault_domain_count: Number of fault domains that the host group can span. + :type platform_fault_domain_count: int + :ivar hosts: A list of references to all dedicated hosts in the dedicated host group. + :vartype hosts: list[~azure.mgmt.compute.v2021_03_01.models.SubResourceReadOnly] + :ivar instance_view: The dedicated host group instance view, which has the list of instance + view of the dedicated hosts under the dedicated host group. + :vartype instance_view: ~azure.mgmt.compute.v2021_03_01.models.DedicatedHostGroupInstanceView + :param support_automatic_placement: Specifies whether virtual machines or virtual machine scale + sets can be placed automatically on the dedicated host group. Automatic placement means + resources are allocated on dedicated hosts, that are chosen by Azure, under the dedicated host + group. The value is defaulted to 'false' when not provided. :code:`
`:code:`
`Minimum + api-version: 2020-06-01. + :type support_automatic_placement: bool """ _validation = { - 'name': {'readonly': True}, - 'label': {'readonly': True}, - 'versions': {'readonly': True}, + 'platform_fault_domain_count': {'minimum': 1}, + 'hosts': {'readonly': True}, + 'instance_view': {'readonly': True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'versions': {'key': 'versions', 'type': '[OSVersionPropertiesBase]'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'zones': {'key': 'zones', 'type': '[str]'}, + 'platform_fault_domain_count': {'key': 'properties.platformFaultDomainCount', 'type': 'int'}, + 'hosts': {'key': 'properties.hosts', 'type': '[SubResourceReadOnly]'}, + 'instance_view': {'key': 'properties.instanceView', 'type': 'DedicatedHostGroupInstanceView'}, + 'support_automatic_placement': {'key': 'properties.supportAutomaticPlacement', 'type': 'bool'}, } def __init__( self, **kwargs ): - super(OSFamilyProperties, self).__init__(**kwargs) - self.name = None - self.label = None - self.versions = None + super(DedicatedHostGroupUpdate, self).__init__(**kwargs) + self.zones = kwargs.get('zones', None) + self.platform_fault_domain_count = kwargs.get('platform_fault_domain_count', None) + self.hosts = None + self.instance_view = None + self.support_automatic_placement = kwargs.get('support_automatic_placement', None) -class OSVersion(msrest.serialization.Model): - """Describes a cloud service OS version. +class DedicatedHostInstanceView(msrest.serialization.Model): + """The instance view of a dedicated host. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar location: Resource location. - :vartype location: str - :param properties: OS version properties. - :type properties: ~azure.mgmt.compute.v2021_03_01.models.OSVersionProperties + :ivar asset_id: Specifies the unique id of the dedicated physical machine on which the + dedicated host resides. + :vartype asset_id: str + :param available_capacity: Unutilized capacity of the dedicated host. + :type available_capacity: ~azure.mgmt.compute.v2021_03_01.models.DedicatedHostAvailableCapacity + :param statuses: The resource status information. + :type statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, + 'asset_id': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'OSVersionProperties'}, + 'asset_id': {'key': 'assetId', 'type': 'str'}, + 'available_capacity': {'key': 'availableCapacity', 'type': 'DedicatedHostAvailableCapacity'}, + 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, } def __init__( self, **kwargs ): - super(OSVersion, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = None - self.properties = kwargs.get('properties', None) + super(DedicatedHostInstanceView, self).__init__(**kwargs) + self.asset_id = None + self.available_capacity = kwargs.get('available_capacity', None) + self.statuses = kwargs.get('statuses', None) -class OSVersionListResult(msrest.serialization.Model): - """OSVersionListResult. +class DedicatedHostInstanceViewWithName(DedicatedHostInstanceView): + """The instance view of a dedicated host that includes the name of the dedicated host. It is used for the response to the instance view of a dedicated host group. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :param value: Required. - :type value: list[~azure.mgmt.compute.v2021_03_01.models.OSVersion] - :param next_link: - :type next_link: str + :ivar asset_id: Specifies the unique id of the dedicated physical machine on which the + dedicated host resides. + :vartype asset_id: str + :param available_capacity: Unutilized capacity of the dedicated host. + :type available_capacity: ~azure.mgmt.compute.v2021_03_01.models.DedicatedHostAvailableCapacity + :param statuses: The resource status information. + :type statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + :ivar name: The name of the dedicated host. + :vartype name: str """ _validation = { - 'value': {'required': True}, + 'asset_id': {'readonly': True}, + 'name': {'readonly': True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[OSVersion]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'asset_id': {'key': 'assetId', 'type': 'str'}, + 'available_capacity': {'key': 'availableCapacity', 'type': 'DedicatedHostAvailableCapacity'}, + 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, + 'name': {'key': 'name', 'type': 'str'}, } def __init__( self, **kwargs ): - super(OSVersionListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) + super(DedicatedHostInstanceViewWithName, self).__init__(**kwargs) + self.name = None + + +class DedicatedHostListResult(msrest.serialization.Model): + """The list dedicated host operation response. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. The list of dedicated hosts. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.DedicatedHost] + :param next_link: The URI to fetch the next page of dedicated hosts. Call ListNext() with this + URI to fetch the next page of dedicated hosts. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DedicatedHost]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DedicatedHostListResult, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = kwargs.get('next_link', None) + + +class DedicatedHostUpdate(UpdateResource): + """Specifies information about the dedicated host. Only tags, autoReplaceOnFailure and licenseType may be updated. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param platform_fault_domain: Fault domain of the dedicated host within a dedicated host group. + :type platform_fault_domain: int + :param auto_replace_on_failure: Specifies whether the dedicated host should be replaced + automatically in case of a failure. The value is defaulted to 'true' when not provided. + :type auto_replace_on_failure: bool + :ivar host_id: A unique id generated and assigned to the dedicated host by the platform. + :code:`
`:code:`
` Does not change throughout the lifetime of the host. + :vartype host_id: str + :ivar virtual_machines: A list of references to all virtual machines in the Dedicated Host. + :vartype virtual_machines: list[~azure.mgmt.compute.v2021_03_01.models.SubResourceReadOnly] + :param license_type: Specifies the software license type that will be applied to the VMs + deployed on the dedicated host. :code:`
`:code:`
` Possible values are: + :code:`
`:code:`
` **None** :code:`
`:code:`
` **Windows_Server_Hybrid** + :code:`
`:code:`
` **Windows_Server_Perpetual** :code:`
`:code:`
` Default: + **None**. Possible values include: "None", "Windows_Server_Hybrid", "Windows_Server_Perpetual". + :type license_type: str or ~azure.mgmt.compute.v2021_03_01.models.DedicatedHostLicenseTypes + :ivar provisioning_time: The date when the host was first provisioned. + :vartype provisioning_time: ~datetime.datetime + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :ivar instance_view: The dedicated host instance view. + :vartype instance_view: ~azure.mgmt.compute.v2021_03_01.models.DedicatedHostInstanceView + """ + + _validation = { + 'platform_fault_domain': {'minimum': 0}, + 'host_id': {'readonly': True}, + 'virtual_machines': {'readonly': True}, + 'provisioning_time': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'instance_view': {'readonly': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'platform_fault_domain': {'key': 'properties.platformFaultDomain', 'type': 'int'}, + 'auto_replace_on_failure': {'key': 'properties.autoReplaceOnFailure', 'type': 'bool'}, + 'host_id': {'key': 'properties.hostId', 'type': 'str'}, + 'virtual_machines': {'key': 'properties.virtualMachines', 'type': '[SubResourceReadOnly]'}, + 'license_type': {'key': 'properties.licenseType', 'type': 'str'}, + 'provisioning_time': {'key': 'properties.provisioningTime', 'type': 'iso-8601'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'instance_view': {'key': 'properties.instanceView', 'type': 'DedicatedHostInstanceView'}, + } + + def __init__( + self, + **kwargs + ): + super(DedicatedHostUpdate, self).__init__(**kwargs) + self.platform_fault_domain = kwargs.get('platform_fault_domain', None) + self.auto_replace_on_failure = kwargs.get('auto_replace_on_failure', None) + self.host_id = None + self.virtual_machines = None + self.license_type = kwargs.get('license_type', None) + self.provisioning_time = None + self.provisioning_state = None + self.instance_view = None + + +class DiagnosticsProfile(msrest.serialization.Model): + """Specifies the boot diagnostic settings state. :code:`
`:code:`
`Minimum api-version: 2015-06-15. + + :param boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + Console Output and Screenshot to diagnose VM status. :code:`
`:code:`
` You can easily + view the output of your console log. :code:`
`:code:`
` Azure also enables you to see a + screenshot of the VM from the hypervisor. + :type boot_diagnostics: ~azure.mgmt.compute.v2021_03_01.models.BootDiagnostics + """ + + _attribute_map = { + 'boot_diagnostics': {'key': 'bootDiagnostics', 'type': 'BootDiagnostics'}, + } + + def __init__( + self, + **kwargs + ): + super(DiagnosticsProfile, self).__init__(**kwargs) + self.boot_diagnostics = kwargs.get('boot_diagnostics', None) + + +class DiffDiskSettings(msrest.serialization.Model): + """Describes the parameters of ephemeral disk settings that can be specified for operating system disk. :code:`
`:code:`
` NOTE: The ephemeral disk settings can only be specified for managed disk. + + :param option: Specifies the ephemeral disk settings for operating system disk. Possible values + include: "Local". + :type option: str or ~azure.mgmt.compute.v2021_03_01.models.DiffDiskOptions + :param placement: Specifies the ephemeral disk placement for operating system + disk.:code:`
`:code:`
` Possible values are: :code:`
`:code:`
` **CacheDisk** + :code:`
`:code:`
` **ResourceDisk** :code:`
`:code:`
` Default: **CacheDisk** if + one is configured for the VM size otherwise **ResourceDisk** is used.:code:`
`:code:`
` + Refer to VM size documentation for Windows VM at https://docs.microsoft.com/en- + us/azure/virtual-machines/windows/sizes and Linux VM at https://docs.microsoft.com/en- + us/azure/virtual-machines/linux/sizes to check which VM sizes exposes a cache disk. Possible + values include: "CacheDisk", "ResourceDisk". + :type placement: str or ~azure.mgmt.compute.v2021_03_01.models.DiffDiskPlacement + """ + + _attribute_map = { + 'option': {'key': 'option', 'type': 'str'}, + 'placement': {'key': 'placement', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DiffDiskSettings, self).__init__(**kwargs) + self.option = kwargs.get('option', None) + self.placement = kwargs.get('placement', None) + + +class DisallowedConfiguration(msrest.serialization.Model): + """Specifies the disallowed configuration for a virtual machine image. + + :param vm_disk_type: VM disk types which are disallowed. Possible values include: "None", + "Unmanaged". + :type vm_disk_type: str or ~azure.mgmt.compute.v2021_03_01.models.VmDiskTypes + """ + + _attribute_map = { + 'vm_disk_type': {'key': 'vmDiskType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DisallowedConfiguration, self).__init__(**kwargs) + self.vm_disk_type = kwargs.get('vm_disk_type', None) + + +class SubResource(msrest.serialization.Model): + """SubResource. + + :param id: Resource Id. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SubResource, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + + +class DiskEncryptionSetParameters(SubResource): + """Describes the parameter of customer managed disk encryption set resource id that can be specified for disk. :code:`
`:code:`
` NOTE: The disk encryption set resource id can only be specified for managed disk. Please refer https://aka.ms/mdssewithcmkoverview for more details. + + :param id: Resource Id. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DiskEncryptionSetParameters, self).__init__(**kwargs) + + +class DiskEncryptionSettings(msrest.serialization.Model): + """Describes a Encryption Settings for a Disk. + + :param disk_encryption_key: Specifies the location of the disk encryption key, which is a Key + Vault Secret. + :type disk_encryption_key: ~azure.mgmt.compute.v2021_03_01.models.KeyVaultSecretReference + :param key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :type key_encryption_key: ~azure.mgmt.compute.v2021_03_01.models.KeyVaultKeyReference + :param enabled: Specifies whether disk encryption should be enabled on the virtual machine. + :type enabled: bool + """ + + _attribute_map = { + 'disk_encryption_key': {'key': 'diskEncryptionKey', 'type': 'KeyVaultSecretReference'}, + 'key_encryption_key': {'key': 'keyEncryptionKey', 'type': 'KeyVaultKeyReference'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(DiskEncryptionSettings, self).__init__(**kwargs) + self.disk_encryption_key = kwargs.get('disk_encryption_key', None) + self.key_encryption_key = kwargs.get('key_encryption_key', None) + self.enabled = kwargs.get('enabled', None) + + +class DiskInstanceView(msrest.serialization.Model): + """The instance view of the disk. + + :param name: The disk name. + :type name: str + :param encryption_settings: Specifies the encryption settings for the OS Disk. + :code:`
`:code:`
` Minimum api-version: 2015-06-15. + :type encryption_settings: list[~azure.mgmt.compute.v2021_03_01.models.DiskEncryptionSettings] + :param statuses: The resource status information. + :type statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'encryption_settings': {'key': 'encryptionSettings', 'type': '[DiskEncryptionSettings]'}, + 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, + } + + def __init__( + self, + **kwargs + ): + super(DiskInstanceView, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.encryption_settings = kwargs.get('encryption_settings', None) + self.statuses = kwargs.get('statuses', None) + + +class ExtendedLocation(msrest.serialization.Model): + """The complex type of the extended location. + + :param name: The name of the extended location. + :type name: str + :param type: The type of the extended location. Possible values include: "EdgeZone". + :type type: str or ~azure.mgmt.compute.v2021_03_01.models.ExtendedLocationTypes + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ExtendedLocation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) + + +class Extension(msrest.serialization.Model): + """Describes a cloud service Extension. + + :param name: The name of the extension. + :type name: str + :param properties: Extension Properties. + :type properties: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceExtensionProperties + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'CloudServiceExtensionProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(Extension, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.properties = kwargs.get('properties', None) + + +class HardwareProfile(msrest.serialization.Model): + """Specifies the hardware settings for the virtual machine. + + :param vm_size: Specifies the size of the virtual machine. :code:`
`:code:`
` The enum + data type is currently deprecated and will be removed by December 23rd 2023. + :code:`
`:code:`
` Recommended way to get the list of available sizes is using these + APIs: :code:`
`:code:`
` `List all available virtual machine sizes in an availability set + `_ + :code:`
`:code:`
` `List all available virtual machine sizes in a region + `_ + :code:`
`:code:`
` `List all available virtual machine sizes for resizing + `_. For more + information about virtual machine sizes, see `Sizes for virtual machines + `_. :code:`
`:code:`
` The + available VM sizes depend on region and availability set. Possible values include: "Basic_A0", + "Basic_A1", "Basic_A2", "Basic_A3", "Basic_A4", "Standard_A0", "Standard_A1", "Standard_A2", + "Standard_A3", "Standard_A4", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", + "Standard_A9", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2_v2", + "Standard_A4_v2", "Standard_A8_v2", "Standard_A2m_v2", "Standard_A4m_v2", "Standard_A8m_v2", + "Standard_B1s", "Standard_B1ms", "Standard_B2s", "Standard_B2ms", "Standard_B4ms", + "Standard_B8ms", "Standard_D1", "Standard_D2", "Standard_D3", "Standard_D4", "Standard_D11", + "Standard_D12", "Standard_D13", "Standard_D14", "Standard_D1_v2", "Standard_D2_v2", + "Standard_D3_v2", "Standard_D4_v2", "Standard_D5_v2", "Standard_D2_v3", "Standard_D4_v3", + "Standard_D8_v3", "Standard_D16_v3", "Standard_D32_v3", "Standard_D64_v3", "Standard_D2s_v3", + "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", "Standard_D32s_v3", + "Standard_D64s_v3", "Standard_D11_v2", "Standard_D12_v2", "Standard_D13_v2", "Standard_D14_v2", + "Standard_D15_v2", "Standard_DS1", "Standard_DS2", "Standard_DS3", "Standard_DS4", + "Standard_DS11", "Standard_DS12", "Standard_DS13", "Standard_DS14", "Standard_DS1_v2", + "Standard_DS2_v2", "Standard_DS3_v2", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_DS11_v2", + "Standard_DS12_v2", "Standard_DS13_v2", "Standard_DS14_v2", "Standard_DS15_v2", + "Standard_DS13-4_v2", "Standard_DS13-2_v2", "Standard_DS14-8_v2", "Standard_DS14-4_v2", + "Standard_E2_v3", "Standard_E4_v3", "Standard_E8_v3", "Standard_E16_v3", "Standard_E32_v3", + "Standard_E64_v3", "Standard_E2s_v3", "Standard_E4s_v3", "Standard_E8s_v3", "Standard_E16s_v3", + "Standard_E32s_v3", "Standard_E64s_v3", "Standard_E32-16_v3", "Standard_E32-8s_v3", + "Standard_E64-32s_v3", "Standard_E64-16s_v3", "Standard_F1", "Standard_F2", "Standard_F4", + "Standard_F8", "Standard_F16", "Standard_F1s", "Standard_F2s", "Standard_F4s", "Standard_F8s", + "Standard_F16s", "Standard_F2s_v2", "Standard_F4s_v2", "Standard_F8s_v2", "Standard_F16s_v2", + "Standard_F32s_v2", "Standard_F64s_v2", "Standard_F72s_v2", "Standard_G1", "Standard_G2", + "Standard_G3", "Standard_G4", "Standard_G5", "Standard_GS1", "Standard_GS2", "Standard_GS3", + "Standard_GS4", "Standard_GS5", "Standard_GS4-8", "Standard_GS4-4", "Standard_GS5-16", + "Standard_GS5-8", "Standard_H8", "Standard_H16", "Standard_H8m", "Standard_H16m", + "Standard_H16r", "Standard_H16mr", "Standard_L4s", "Standard_L8s", "Standard_L16s", + "Standard_L32s", "Standard_M64s", "Standard_M64ms", "Standard_M128s", "Standard_M128ms", + "Standard_M64-32ms", "Standard_M64-16ms", "Standard_M128-64ms", "Standard_M128-32ms", + "Standard_NC6", "Standard_NC12", "Standard_NC24", "Standard_NC24r", "Standard_NC6s_v2", + "Standard_NC12s_v2", "Standard_NC24s_v2", "Standard_NC24rs_v2", "Standard_NC6s_v3", + "Standard_NC12s_v3", "Standard_NC24s_v3", "Standard_NC24rs_v3", "Standard_ND6s", + "Standard_ND12s", "Standard_ND24s", "Standard_ND24rs", "Standard_NV6", "Standard_NV12", + "Standard_NV24". + :type vm_size: str or ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineSizeTypes + """ + + _attribute_map = { + 'vm_size': {'key': 'vmSize', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(HardwareProfile, self).__init__(**kwargs) + self.vm_size = kwargs.get('vm_size', None) + + +class Image(Resource): + """The source user image virtual hard disk. The virtual hard disk will be copied before being attached to the virtual machine. If SourceImage is provided, the destination virtual hard drive must not exist. + + 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 id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param extended_location: The extended location of the Image. + :type extended_location: ~azure.mgmt.compute.v2021_03_01.models.ExtendedLocation + :param source_virtual_machine: The source virtual machine from which Image is created. + :type source_virtual_machine: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param storage_profile: Specifies the storage settings for the virtual machine disks. + :type storage_profile: ~azure.mgmt.compute.v2021_03_01.models.ImageStorageProfile + :ivar provisioning_state: The provisioning state. + :vartype provisioning_state: str + :param hyper_v_generation: Specifies the HyperVGenerationType of the VirtualMachine created + from the image. From API Version 2019-03-01 if the image source is a blob, then we need the + user to specify the value, if the source is managed resource like disk or snapshot, we may + require the user to specify the property if we cannot deduce it from the source managed + resource. Possible values include: "V1", "V2". + :type hyper_v_generation: str or ~azure.mgmt.compute.v2021_03_01.models.HyperVGenerationTypes + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, + 'source_virtual_machine': {'key': 'properties.sourceVirtualMachine', 'type': 'SubResource'}, + 'storage_profile': {'key': 'properties.storageProfile', 'type': 'ImageStorageProfile'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Image, self).__init__(**kwargs) + self.extended_location = kwargs.get('extended_location', None) + self.source_virtual_machine = kwargs.get('source_virtual_machine', None) + self.storage_profile = kwargs.get('storage_profile', None) + self.provisioning_state = None + self.hyper_v_generation = kwargs.get('hyper_v_generation', None) + + +class ImageDisk(msrest.serialization.Model): + """Describes a image disk. + + :param snapshot: The snapshot. + :type snapshot: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param managed_disk: The managedDisk. + :type managed_disk: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param blob_uri: The Virtual Hard Disk. + :type blob_uri: str + :param caching: Specifies the caching requirements. :code:`
`:code:`
` Possible values + are: :code:`
`:code:`
` **None** :code:`
`:code:`
` **ReadOnly** + :code:`
`:code:`
` **ReadWrite** :code:`
`:code:`
` Default: **None for Standard + storage. ReadOnly for Premium storage**. Possible values include: "None", "ReadOnly", + "ReadWrite". + :type caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes + :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + used to overwrite the name of the disk in a virtual machine image. :code:`
`:code:`
` + This value cannot be larger than 1023 GB. + :type disk_size_gb: int + :param storage_account_type: Specifies the storage account type for the managed disk. NOTE: + UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. Possible values + include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", + "StandardSSD_ZRS". + :type storage_account_type: str or ~azure.mgmt.compute.v2021_03_01.models.StorageAccountTypes + :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + the managed image disk. + :type disk_encryption_set: ~azure.mgmt.compute.v2021_03_01.models.DiskEncryptionSetParameters + """ + + _attribute_map = { + 'snapshot': {'key': 'snapshot', 'type': 'SubResource'}, + 'managed_disk': {'key': 'managedDisk', 'type': 'SubResource'}, + 'blob_uri': {'key': 'blobUri', 'type': 'str'}, + 'caching': {'key': 'caching', 'type': 'str'}, + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, + 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, + 'disk_encryption_set': {'key': 'diskEncryptionSet', 'type': 'DiskEncryptionSetParameters'}, + } + + def __init__( + self, + **kwargs + ): + super(ImageDisk, self).__init__(**kwargs) + self.snapshot = kwargs.get('snapshot', None) + self.managed_disk = kwargs.get('managed_disk', None) + self.blob_uri = kwargs.get('blob_uri', None) + self.caching = kwargs.get('caching', None) + self.disk_size_gb = kwargs.get('disk_size_gb', None) + self.storage_account_type = kwargs.get('storage_account_type', None) + self.disk_encryption_set = kwargs.get('disk_encryption_set', None) + + +class ImageDataDisk(ImageDisk): + """Describes a data disk. + + All required parameters must be populated in order to send to Azure. + + :param snapshot: The snapshot. + :type snapshot: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param managed_disk: The managedDisk. + :type managed_disk: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param blob_uri: The Virtual Hard Disk. + :type blob_uri: str + :param caching: Specifies the caching requirements. :code:`
`:code:`
` Possible values + are: :code:`
`:code:`
` **None** :code:`
`:code:`
` **ReadOnly** + :code:`
`:code:`
` **ReadWrite** :code:`
`:code:`
` Default: **None for Standard + storage. ReadOnly for Premium storage**. Possible values include: "None", "ReadOnly", + "ReadWrite". + :type caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes + :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + used to overwrite the name of the disk in a virtual machine image. :code:`
`:code:`
` + This value cannot be larger than 1023 GB. + :type disk_size_gb: int + :param storage_account_type: Specifies the storage account type for the managed disk. NOTE: + UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. Possible values + include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", + "StandardSSD_ZRS". + :type storage_account_type: str or ~azure.mgmt.compute.v2021_03_01.models.StorageAccountTypes + :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + the managed image disk. + :type disk_encryption_set: ~azure.mgmt.compute.v2021_03_01.models.DiskEncryptionSetParameters + :param lun: Required. Specifies the logical unit number of the data disk. This value is used to + identify data disks within the VM and therefore must be unique for each data disk attached to a + VM. + :type lun: int + """ + + _validation = { + 'lun': {'required': True}, + } + + _attribute_map = { + 'snapshot': {'key': 'snapshot', 'type': 'SubResource'}, + 'managed_disk': {'key': 'managedDisk', 'type': 'SubResource'}, + 'blob_uri': {'key': 'blobUri', 'type': 'str'}, + 'caching': {'key': 'caching', 'type': 'str'}, + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, + 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, + 'disk_encryption_set': {'key': 'diskEncryptionSet', 'type': 'DiskEncryptionSetParameters'}, + 'lun': {'key': 'lun', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(ImageDataDisk, self).__init__(**kwargs) + self.lun = kwargs['lun'] + + +class ImageListResult(msrest.serialization.Model): + """The List Image operation response. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. The list of Images. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.Image] + :param next_link: The uri to fetch the next page of Images. Call ListNext() with this to fetch + the next page of Images. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Image]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ImageListResult, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = kwargs.get('next_link', None) + + +class ImageOSDisk(ImageDisk): + """Describes an Operating System disk. + + All required parameters must be populated in order to send to Azure. + + :param snapshot: The snapshot. + :type snapshot: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param managed_disk: The managedDisk. + :type managed_disk: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param blob_uri: The Virtual Hard Disk. + :type blob_uri: str + :param caching: Specifies the caching requirements. :code:`
`:code:`
` Possible values + are: :code:`
`:code:`
` **None** :code:`
`:code:`
` **ReadOnly** + :code:`
`:code:`
` **ReadWrite** :code:`
`:code:`
` Default: **None for Standard + storage. ReadOnly for Premium storage**. Possible values include: "None", "ReadOnly", + "ReadWrite". + :type caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes + :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + used to overwrite the name of the disk in a virtual machine image. :code:`
`:code:`
` + This value cannot be larger than 1023 GB. + :type disk_size_gb: int + :param storage_account_type: Specifies the storage account type for the managed disk. NOTE: + UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. Possible values + include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", + "StandardSSD_ZRS". + :type storage_account_type: str or ~azure.mgmt.compute.v2021_03_01.models.StorageAccountTypes + :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + the managed image disk. + :type disk_encryption_set: ~azure.mgmt.compute.v2021_03_01.models.DiskEncryptionSetParameters + :param os_type: Required. This property allows you to specify the type of the OS that is + included in the disk if creating a VM from a custom image. :code:`
`:code:`
` Possible + values are: :code:`
`:code:`
` **Windows** :code:`
`:code:`
` **Linux**. Possible + values include: "Windows", "Linux". + :type os_type: str or ~azure.mgmt.compute.v2021_03_01.models.OperatingSystemTypes + :param os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". + :type os_state: str or ~azure.mgmt.compute.v2021_03_01.models.OperatingSystemStateTypes + """ + + _validation = { + 'os_type': {'required': True}, + 'os_state': {'required': True}, + } + + _attribute_map = { + 'snapshot': {'key': 'snapshot', 'type': 'SubResource'}, + 'managed_disk': {'key': 'managedDisk', 'type': 'SubResource'}, + 'blob_uri': {'key': 'blobUri', 'type': 'str'}, + 'caching': {'key': 'caching', 'type': 'str'}, + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, + 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, + 'disk_encryption_set': {'key': 'diskEncryptionSet', 'type': 'DiskEncryptionSetParameters'}, + 'os_type': {'key': 'osType', 'type': 'str'}, + 'os_state': {'key': 'osState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ImageOSDisk, self).__init__(**kwargs) + self.os_type = kwargs['os_type'] + self.os_state = kwargs['os_state'] + + +class ImageReference(SubResource): + """Specifies information about the image to use. You can specify information about platform images, marketplace images, or virtual machine images. This element is required when you want to use a platform image, marketplace image, or virtual machine image, but is not used in other creation operations. NOTE: Image reference publisher and offer can only be set when you create the scale set. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param id: Resource Id. + :type id: str + :param publisher: The image publisher. + :type publisher: str + :param offer: Specifies the offer of the platform image or marketplace image used to create the + virtual machine. + :type offer: str + :param sku: The image SKU. + :type sku: str + :param version: Specifies the version of the platform image or marketplace image used to create + the virtual machine. The allowed formats are Major.Minor.Build or 'latest'. Major, Minor, and + Build are decimal numbers. Specify 'latest' to use the latest version of an image available at + deploy time. Even if you use 'latest', the VM image will not automatically update after deploy + time even if a new version becomes available. + :type version: str + :ivar exact_version: Specifies in decimal numbers, the version of platform image or marketplace + image used to create the virtual machine. This readonly field differs from 'version', only if + the value specified in 'version' field is 'latest'. + :vartype exact_version: str + """ + + _validation = { + 'exact_version': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'offer': {'key': 'offer', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'exact_version': {'key': 'exactVersion', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ImageReference, self).__init__(**kwargs) + self.publisher = kwargs.get('publisher', None) + self.offer = kwargs.get('offer', None) + self.sku = kwargs.get('sku', None) + self.version = kwargs.get('version', None) + self.exact_version = None + + +class ImageStorageProfile(msrest.serialization.Model): + """Describes a storage profile. + + :param os_disk: Specifies information about the operating system disk used by the virtual + machine. :code:`
`:code:`
` For more information about disks, see `About disks and VHDs + for Azure virtual machines `_. + :type os_disk: ~azure.mgmt.compute.v2021_03_01.models.ImageOSDisk + :param data_disks: Specifies the parameters that are used to add a data disk to a virtual + machine. :code:`
`:code:`
` For more information about disks, see `About disks and VHDs + for Azure virtual machines `_. + :type data_disks: list[~azure.mgmt.compute.v2021_03_01.models.ImageDataDisk] + :param zone_resilient: Specifies whether an image is zone resilient or not. Default is false. + Zone resilient images can be created only in regions that provide Zone Redundant Storage (ZRS). + :type zone_resilient: bool + """ + + _attribute_map = { + 'os_disk': {'key': 'osDisk', 'type': 'ImageOSDisk'}, + 'data_disks': {'key': 'dataDisks', 'type': '[ImageDataDisk]'}, + 'zone_resilient': {'key': 'zoneResilient', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(ImageStorageProfile, self).__init__(**kwargs) + self.os_disk = kwargs.get('os_disk', None) + self.data_disks = kwargs.get('data_disks', None) + self.zone_resilient = kwargs.get('zone_resilient', None) + + +class ImageUpdate(UpdateResource): + """The source user image virtual hard disk. Only tags may be updated. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param source_virtual_machine: The source virtual machine from which Image is created. + :type source_virtual_machine: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param storage_profile: Specifies the storage settings for the virtual machine disks. + :type storage_profile: ~azure.mgmt.compute.v2021_03_01.models.ImageStorageProfile + :ivar provisioning_state: The provisioning state. + :vartype provisioning_state: str + :param hyper_v_generation: Specifies the HyperVGenerationType of the VirtualMachine created + from the image. From API Version 2019-03-01 if the image source is a blob, then we need the + user to specify the value, if the source is managed resource like disk or snapshot, we may + require the user to specify the property if we cannot deduce it from the source managed + resource. Possible values include: "V1", "V2". + :type hyper_v_generation: str or ~azure.mgmt.compute.v2021_03_01.models.HyperVGenerationTypes + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'source_virtual_machine': {'key': 'properties.sourceVirtualMachine', 'type': 'SubResource'}, + 'storage_profile': {'key': 'properties.storageProfile', 'type': 'ImageStorageProfile'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ImageUpdate, self).__init__(**kwargs) + self.source_virtual_machine = kwargs.get('source_virtual_machine', None) + self.storage_profile = kwargs.get('storage_profile', None) + self.provisioning_state = None + self.hyper_v_generation = kwargs.get('hyper_v_generation', None) + + +class InnerError(msrest.serialization.Model): + """Inner error details. + + :param exceptiontype: The exception type. + :type exceptiontype: str + :param errordetail: The internal error message or exception dump. + :type errordetail: str + """ + + _attribute_map = { + 'exceptiontype': {'key': 'exceptiontype', 'type': 'str'}, + 'errordetail': {'key': 'errordetail', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(InnerError, self).__init__(**kwargs) + self.exceptiontype = kwargs.get('exceptiontype', None) + self.errordetail = kwargs.get('errordetail', None) + + +class InstanceSku(msrest.serialization.Model): + """InstanceSku. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The sku name. + :vartype name: str + :ivar tier: The tier of the cloud service role instance. + :vartype tier: str + """ + + _validation = { + 'name': {'readonly': True}, + 'tier': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(InstanceSku, self).__init__(**kwargs) + self.name = None + self.tier = None + + +class InstanceViewStatus(msrest.serialization.Model): + """Instance view status. + + :param code: The status code. + :type code: str + :param level: The level code. Possible values include: "Info", "Warning", "Error". + :type level: str or ~azure.mgmt.compute.v2021_03_01.models.StatusLevelTypes + :param display_status: The short localizable label for the status. + :type display_status: str + :param message: The detailed status message, including for alerts and error messages. + :type message: str + :param time: The time of the status. + :type time: ~datetime.datetime + """ + + _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(InstanceViewStatus, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.level = kwargs.get('level', None) + self.display_status = kwargs.get('display_status', None) + self.message = kwargs.get('message', None) + self.time = kwargs.get('time', None) + + +class InstanceViewStatusesSummary(msrest.serialization.Model): + """Instance view statuses. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar statuses_summary: + :vartype statuses_summary: list[~azure.mgmt.compute.v2021_03_01.models.StatusCodeCount] + """ + + _validation = { + 'statuses_summary': {'readonly': True}, + } + + _attribute_map = { + 'statuses_summary': {'key': 'statusesSummary', 'type': '[StatusCodeCount]'}, + } + + def __init__( + self, + **kwargs + ): + super(InstanceViewStatusesSummary, self).__init__(**kwargs) + self.statuses_summary = None + + +class KeyVaultKeyReference(msrest.serialization.Model): + """Describes a reference to Key Vault Key. + + All required parameters must be populated in order to send to Azure. + + :param key_url: Required. The URL referencing a key encryption key in Key Vault. + :type key_url: str + :param source_vault: Required. The relative URL of the Key Vault containing the key. + :type source_vault: ~azure.mgmt.compute.v2021_03_01.models.SubResource + """ + + _validation = { + 'key_url': {'required': True}, + 'source_vault': {'required': True}, + } + + _attribute_map = { + 'key_url': {'key': 'keyUrl', 'type': 'str'}, + 'source_vault': {'key': 'sourceVault', 'type': 'SubResource'}, + } + + def __init__( + self, + **kwargs + ): + super(KeyVaultKeyReference, self).__init__(**kwargs) + self.key_url = kwargs['key_url'] + self.source_vault = kwargs['source_vault'] + + +class KeyVaultSecretReference(msrest.serialization.Model): + """Describes a reference to Key Vault Secret. + + All required parameters must be populated in order to send to Azure. + + :param secret_url: Required. The URL referencing a secret in a Key Vault. + :type secret_url: str + :param source_vault: Required. The relative URL of the Key Vault containing the secret. + :type source_vault: ~azure.mgmt.compute.v2021_03_01.models.SubResource + """ + + _validation = { + 'secret_url': {'required': True}, + 'source_vault': {'required': True}, + } + + _attribute_map = { + 'secret_url': {'key': 'secretUrl', 'type': 'str'}, + 'source_vault': {'key': 'sourceVault', 'type': 'SubResource'}, + } + + def __init__( + self, + **kwargs + ): + super(KeyVaultSecretReference, self).__init__(**kwargs) + self.secret_url = kwargs['secret_url'] + self.source_vault = kwargs['source_vault'] + + +class LastPatchInstallationSummary(msrest.serialization.Model): + """Describes the properties of the last installed patch summary. + + 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 "Unknown", "Failed", "Succeeded", + or "CompletedWithWarnings.". Possible values include: "Unknown", "InProgress", "Failed", + "Succeeded", "CompletedWithWarnings". + :vartype status: str or ~azure.mgmt.compute.v2021_03_01.models.PatchOperationStatus + :ivar installation_activity_id: The activity ID of the operation that produced this result. It + is used to correlate across CRP and extension logs. + :vartype installation_activity_id: str + :ivar maintenance_window_exceeded: Describes whether the operation ran out of time before it + completed all its intended actions. + :vartype maintenance_window_exceeded: bool + :ivar not_selected_patch_count: The number of all available patches but not going to be + installed because it didn't match a classification or inclusion list entry. + :vartype not_selected_patch_count: int + :ivar excluded_patch_count: The number of all available patches but excluded explicitly by a + customer-specified exclusion list match. + :vartype excluded_patch_count: int + :ivar pending_patch_count: The number of all available patches expected to be installed over + the course of the patch installation operation. + :vartype pending_patch_count: int + :ivar installed_patch_count: The count of patches that successfully installed. + :vartype installed_patch_count: int + :ivar failed_patch_count: The count of patches that failed installation. + :vartype failed_patch_count: int + :ivar start_time: The UTC timestamp when the operation began. + :vartype start_time: ~datetime.datetime + :ivar last_modified_time: The UTC timestamp when the operation began. + :vartype last_modified_time: ~datetime.datetime + :ivar error: The errors that were encountered during execution of the operation. The details + array contains the list of them. + :vartype error: ~azure.mgmt.compute.v2021_03_01.models.ApiError + """ + + _validation = { + 'status': {'readonly': True}, + 'installation_activity_id': {'readonly': True}, + 'maintenance_window_exceeded': {'readonly': True}, + 'not_selected_patch_count': {'readonly': True}, + 'excluded_patch_count': {'readonly': True}, + 'pending_patch_count': {'readonly': True}, + 'installed_patch_count': {'readonly': True}, + 'failed_patch_count': {'readonly': True}, + 'start_time': {'readonly': True}, + 'last_modified_time': {'readonly': True}, + 'error': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'installation_activity_id': {'key': 'installationActivityId', 'type': 'str'}, + 'maintenance_window_exceeded': {'key': 'maintenanceWindowExceeded', 'type': 'bool'}, + 'not_selected_patch_count': {'key': 'notSelectedPatchCount', 'type': 'int'}, + 'excluded_patch_count': {'key': 'excludedPatchCount', 'type': 'int'}, + 'pending_patch_count': {'key': 'pendingPatchCount', 'type': 'int'}, + 'installed_patch_count': {'key': 'installedPatchCount', 'type': 'int'}, + 'failed_patch_count': {'key': 'failedPatchCount', 'type': 'int'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'last_modified_time': {'key': 'lastModifiedTime', 'type': 'iso-8601'}, + 'error': {'key': 'error', 'type': 'ApiError'}, + } + + def __init__( + self, + **kwargs + ): + super(LastPatchInstallationSummary, self).__init__(**kwargs) + self.status = None + self.installation_activity_id = None + self.maintenance_window_exceeded = None + self.not_selected_patch_count = None + self.excluded_patch_count = None + self.pending_patch_count = None + self.installed_patch_count = None + self.failed_patch_count = None + self.start_time = None + self.last_modified_time = None + self.error = None + + +class LinuxConfiguration(msrest.serialization.Model): + """Specifies the Linux operating system settings on the virtual machine. :code:`
`:code:`
`For a list of supported Linux distributions, see `Linux on Azure-Endorsed Distributions `_ :code:`
`:code:`
` For running non-endorsed distributions, see `Information for Non-Endorsed Distributions `_. + + :param disable_password_authentication: Specifies whether password authentication should be + disabled. + :type disable_password_authentication: bool + :param ssh: Specifies the ssh key configuration for a Linux OS. + :type ssh: ~azure.mgmt.compute.v2021_03_01.models.SshConfiguration + :param provision_vm_agent: Indicates whether virtual machine agent should be provisioned on the + virtual machine. :code:`
`:code:`
` When this property is not specified in the request + body, default behavior is to set it to true. This will ensure that VM Agent is installed on + the VM so that extensions can be added to the VM later. + :type provision_vm_agent: bool + :param patch_settings: [Preview Feature] Specifies settings related to VM Guest Patching on + Linux. + :type patch_settings: ~azure.mgmt.compute.v2021_03_01.models.LinuxPatchSettings + """ + + _attribute_map = { + 'disable_password_authentication': {'key': 'disablePasswordAuthentication', 'type': 'bool'}, + 'ssh': {'key': 'ssh', 'type': 'SshConfiguration'}, + 'provision_vm_agent': {'key': 'provisionVMAgent', 'type': 'bool'}, + 'patch_settings': {'key': 'patchSettings', 'type': 'LinuxPatchSettings'}, + } + + def __init__( + self, + **kwargs + ): + super(LinuxConfiguration, self).__init__(**kwargs) + self.disable_password_authentication = kwargs.get('disable_password_authentication', None) + self.ssh = kwargs.get('ssh', None) + self.provision_vm_agent = kwargs.get('provision_vm_agent', None) + self.patch_settings = kwargs.get('patch_settings', None) + + +class LinuxParameters(msrest.serialization.Model): + """Input for InstallPatches on a Linux VM, as directly received by the API. + + :param classifications_to_include: The update classifications to select when installing patches + for Linux. + :type classifications_to_include: list[str or + ~azure.mgmt.compute.v2021_03_01.models.VMGuestPatchClassificationLinux] + :param package_name_masks_to_include: packages to include in the patch operation. Format: + packageName_packageVersion. + :type package_name_masks_to_include: list[str] + :param package_name_masks_to_exclude: packages to exclude in the patch operation. Format: + packageName_packageVersion. + :type package_name_masks_to_exclude: list[str] + :param maintenance_run_id: This is used as a maintenance run identifier for Auto VM Guest + Patching in Linux. + :type maintenance_run_id: str + """ + + _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]'}, + 'maintenance_run_id': {'key': 'maintenanceRunId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(LinuxParameters, self).__init__(**kwargs) + self.classifications_to_include = kwargs.get('classifications_to_include', None) + self.package_name_masks_to_include = kwargs.get('package_name_masks_to_include', None) + self.package_name_masks_to_exclude = kwargs.get('package_name_masks_to_exclude', None) + self.maintenance_run_id = kwargs.get('maintenance_run_id', None) + + +class LinuxPatchSettings(msrest.serialization.Model): + """Specifies settings related to VM Guest Patching on Linux. + + :param patch_mode: Specifies the mode of VM Guest Patching to IaaS virtual machine.:code:`
`:code:`
` Possible values are::code:`
`:code:`
` **ImageDefault** - The + virtual machine's default patching configuration is used. :code:`
`:code:`
` + **AutomaticByPlatform** - The virtual machine will be automatically updated by the platform. + The property provisionVMAgent must be true. Possible values include: "ImageDefault", + "AutomaticByPlatform". + :type patch_mode: str or ~azure.mgmt.compute.v2021_03_01.models.LinuxVMGuestPatchMode + """ + + _attribute_map = { + 'patch_mode': {'key': 'patchMode', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(LinuxPatchSettings, self).__init__(**kwargs) + self.patch_mode = kwargs.get('patch_mode', None) + + +class ListUsagesResult(msrest.serialization.Model): + """The List Usages operation response. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. The list of compute resource usages. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.Usage] + :param next_link: The URI to fetch the next page of compute resource usage information. Call + ListNext() with this to fetch the next page of compute resource usage information. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Usage]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ListUsagesResult, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = kwargs.get('next_link', None) + + +class LoadBalancerConfiguration(msrest.serialization.Model): + """Describes the load balancer configuration. + + All required parameters must be populated in order to send to Azure. + + :param id: Resource Id. + :type id: str + :param name: Required. The name of the Load balancer. + :type name: str + :param properties: Required. Properties of the load balancer configuration. + :type properties: ~azure.mgmt.compute.v2021_03_01.models.LoadBalancerConfigurationProperties + """ + + _validation = { + 'name': {'required': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'LoadBalancerConfigurationProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(LoadBalancerConfiguration, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.name = kwargs['name'] + self.properties = kwargs['properties'] + + +class LoadBalancerConfigurationProperties(msrest.serialization.Model): + """LoadBalancerConfigurationProperties. + + All required parameters must be populated in order to send to Azure. + + :param frontend_ip_configurations: Required. Specifies the frontend IP to be used for the load + balancer. Only IPv4 frontend IP address is supported. Each load balancer configuration must + have exactly one frontend IP configuration. + :type frontend_ip_configurations: + list[~azure.mgmt.compute.v2021_03_01.models.LoadBalancerFrontendIPConfiguration] + """ + + _validation = { + 'frontend_ip_configurations': {'required': True}, + } + + _attribute_map = { + 'frontend_ip_configurations': {'key': 'frontendIPConfigurations', 'type': '[LoadBalancerFrontendIPConfiguration]'}, + } + + def __init__( + self, + **kwargs + ): + super(LoadBalancerConfigurationProperties, self).__init__(**kwargs) + self.frontend_ip_configurations = kwargs['frontend_ip_configurations'] + + +class LoadBalancerFrontendIPConfiguration(msrest.serialization.Model): + """LoadBalancerFrontendIPConfiguration. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the resource that is unique within the set of frontend IP + configurations used by the load balancer. This name can be used to access the resource. + :type name: str + :param properties: Required. Properties of load balancer frontend ip configuration. + :type properties: + ~azure.mgmt.compute.v2021_03_01.models.LoadBalancerFrontendIPConfigurationProperties + """ + + _validation = { + 'name': {'required': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'LoadBalancerFrontendIPConfigurationProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(LoadBalancerFrontendIPConfiguration, self).__init__(**kwargs) + self.name = kwargs['name'] + self.properties = kwargs['properties'] + + +class LoadBalancerFrontendIPConfigurationProperties(msrest.serialization.Model): + """Describes a cloud service IP Configuration. + + :param public_ip_address: The reference to the public ip address resource. + :type public_ip_address: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param subnet: The reference to the virtual network subnet resource. + :type subnet: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param private_ip_address: The virtual network private IP address of the IP configuration. + :type private_ip_address: str + """ + + _attribute_map = { + 'public_ip_address': {'key': 'publicIPAddress', 'type': 'SubResource'}, + 'subnet': {'key': 'subnet', 'type': 'SubResource'}, + 'private_ip_address': {'key': 'privateIPAddress', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(LoadBalancerFrontendIPConfigurationProperties, self).__init__(**kwargs) + self.public_ip_address = kwargs.get('public_ip_address', None) + self.subnet = kwargs.get('subnet', None) + self.private_ip_address = kwargs.get('private_ip_address', None) + + +class LogAnalyticsInputBase(msrest.serialization.Model): + """Api input base class for LogAnalytics Api. + + All required parameters must be populated in order to send to Azure. + + :param blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :type blob_container_sas_uri: str + :param from_time: Required. From time of the query. + :type from_time: ~datetime.datetime + :param to_time: Required. To time of the query. + :type to_time: ~datetime.datetime + :param group_by_throttle_policy: Group query result by Throttle Policy applied. + :type group_by_throttle_policy: bool + :param group_by_operation_name: Group query result by Operation Name. + :type group_by_operation_name: bool + :param group_by_resource_name: Group query result by Resource Name. + :type group_by_resource_name: bool + :param group_by_client_application_id: Group query result by Client Application ID. + :type group_by_client_application_id: bool + :param group_by_user_agent: Group query result by User Agent. + :type group_by_user_agent: bool + """ + + _validation = { + 'blob_container_sas_uri': {'required': True}, + 'from_time': {'required': True}, + 'to_time': {'required': True}, + } + + _attribute_map = { + 'blob_container_sas_uri': {'key': 'blobContainerSasUri', 'type': 'str'}, + 'from_time': {'key': 'fromTime', 'type': 'iso-8601'}, + 'to_time': {'key': 'toTime', 'type': 'iso-8601'}, + 'group_by_throttle_policy': {'key': 'groupByThrottlePolicy', 'type': 'bool'}, + 'group_by_operation_name': {'key': 'groupByOperationName', 'type': 'bool'}, + 'group_by_resource_name': {'key': 'groupByResourceName', 'type': 'bool'}, + 'group_by_client_application_id': {'key': 'groupByClientApplicationId', 'type': 'bool'}, + 'group_by_user_agent': {'key': 'groupByUserAgent', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(LogAnalyticsInputBase, self).__init__(**kwargs) + self.blob_container_sas_uri = kwargs['blob_container_sas_uri'] + self.from_time = kwargs['from_time'] + self.to_time = kwargs['to_time'] + self.group_by_throttle_policy = kwargs.get('group_by_throttle_policy', None) + self.group_by_operation_name = kwargs.get('group_by_operation_name', None) + self.group_by_resource_name = kwargs.get('group_by_resource_name', None) + self.group_by_client_application_id = kwargs.get('group_by_client_application_id', None) + self.group_by_user_agent = kwargs.get('group_by_user_agent', None) + + +class LogAnalyticsOperationResult(msrest.serialization.Model): + """LogAnalytics operation status response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar properties: LogAnalyticsOutput. + :vartype properties: ~azure.mgmt.compute.v2021_03_01.models.LogAnalyticsOutput + """ + + _validation = { + 'properties': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'LogAnalyticsOutput'}, + } + + def __init__( + self, + **kwargs + ): + super(LogAnalyticsOperationResult, self).__init__(**kwargs) + self.properties = None + + +class LogAnalyticsOutput(msrest.serialization.Model): + """LogAnalytics output properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar output: Output file Uri path to blob container. + :vartype output: str + """ + + _validation = { + 'output': {'readonly': True}, + } + + _attribute_map = { + 'output': {'key': 'output', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(LogAnalyticsOutput, self).__init__(**kwargs) + self.output = None + + +class MaintenanceRedeployStatus(msrest.serialization.Model): + """Maintenance Operation Status. + + :param is_customer_initiated_maintenance_allowed: True, if customer is allowed to perform + Maintenance. + :type is_customer_initiated_maintenance_allowed: bool + :param pre_maintenance_window_start_time: Start Time for the Pre Maintenance Window. + :type pre_maintenance_window_start_time: ~datetime.datetime + :param pre_maintenance_window_end_time: End Time for the Pre Maintenance Window. + :type pre_maintenance_window_end_time: ~datetime.datetime + :param maintenance_window_start_time: Start Time for the Maintenance Window. + :type maintenance_window_start_time: ~datetime.datetime + :param maintenance_window_end_time: End Time for the Maintenance Window. + :type maintenance_window_end_time: ~datetime.datetime + :param last_operation_result_code: The Last Maintenance Operation Result Code. Possible values + include: "None", "RetryLater", "MaintenanceAborted", "MaintenanceCompleted". + :type last_operation_result_code: str or + ~azure.mgmt.compute.v2021_03_01.models.MaintenanceOperationResultCodeTypes + :param last_operation_message: Message returned for the last Maintenance Operation. + :type last_operation_message: str + """ + + _attribute_map = { + 'is_customer_initiated_maintenance_allowed': {'key': 'isCustomerInitiatedMaintenanceAllowed', 'type': 'bool'}, + 'pre_maintenance_window_start_time': {'key': 'preMaintenanceWindowStartTime', 'type': 'iso-8601'}, + 'pre_maintenance_window_end_time': {'key': 'preMaintenanceWindowEndTime', 'type': 'iso-8601'}, + 'maintenance_window_start_time': {'key': 'maintenanceWindowStartTime', 'type': 'iso-8601'}, + 'maintenance_window_end_time': {'key': 'maintenanceWindowEndTime', 'type': 'iso-8601'}, + 'last_operation_result_code': {'key': 'lastOperationResultCode', 'type': 'str'}, + 'last_operation_message': {'key': 'lastOperationMessage', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MaintenanceRedeployStatus, self).__init__(**kwargs) + self.is_customer_initiated_maintenance_allowed = kwargs.get('is_customer_initiated_maintenance_allowed', None) + self.pre_maintenance_window_start_time = kwargs.get('pre_maintenance_window_start_time', None) + self.pre_maintenance_window_end_time = kwargs.get('pre_maintenance_window_end_time', None) + self.maintenance_window_start_time = kwargs.get('maintenance_window_start_time', None) + self.maintenance_window_end_time = kwargs.get('maintenance_window_end_time', None) + self.last_operation_result_code = kwargs.get('last_operation_result_code', None) + self.last_operation_message = kwargs.get('last_operation_message', None) + + +class ManagedDiskParameters(SubResource): + """The parameters of a managed disk. + + :param id: Resource Id. + :type id: str + :param storage_account_type: Specifies the storage account type for the managed disk. NOTE: + UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. Possible values + include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", + "StandardSSD_ZRS". + :type storage_account_type: str or ~azure.mgmt.compute.v2021_03_01.models.StorageAccountTypes + :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + the managed disk. + :type disk_encryption_set: ~azure.mgmt.compute.v2021_03_01.models.DiskEncryptionSetParameters + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, + 'disk_encryption_set': {'key': 'diskEncryptionSet', 'type': 'DiskEncryptionSetParameters'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagedDiskParameters, self).__init__(**kwargs) + self.storage_account_type = kwargs.get('storage_account_type', None) + self.disk_encryption_set = kwargs.get('disk_encryption_set', None) + + +class NetworkInterfaceReference(SubResource): + """Describes a network interface reference. + + :param id: Resource Id. + :type id: str + :param primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :type primary: bool + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'primary': {'key': 'properties.primary', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkInterfaceReference, self).__init__(**kwargs) + self.primary = kwargs.get('primary', None) + + +class NetworkProfile(msrest.serialization.Model): + """Specifies the network interfaces of the virtual machine. + + :param network_interfaces: Specifies the list of resource Ids for the network interfaces + associated with the virtual machine. + :type network_interfaces: + list[~azure.mgmt.compute.v2021_03_01.models.NetworkInterfaceReference] + """ + + _attribute_map = { + 'network_interfaces': {'key': 'networkInterfaces', 'type': '[NetworkInterfaceReference]'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkProfile, self).__init__(**kwargs) + self.network_interfaces = kwargs.get('network_interfaces', None) + + +class OrchestrationServiceStateInput(msrest.serialization.Model): + """The input for OrchestrationServiceState. + + All required parameters must be populated in order to send to Azure. + + :param service_name: Required. The name of the service. Possible values include: + "AutomaticRepairs", "DummyOrchestrationServiceName". + :type service_name: str or ~azure.mgmt.compute.v2021_03_01.models.OrchestrationServiceNames + :param action: Required. The action to be performed. Possible values include: "Resume", + "Suspend". + :type action: str or ~azure.mgmt.compute.v2021_03_01.models.OrchestrationServiceStateAction + """ + + _validation = { + 'service_name': {'required': True}, + 'action': {'required': True}, + } + + _attribute_map = { + 'service_name': {'key': 'serviceName', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OrchestrationServiceStateInput, self).__init__(**kwargs) + self.service_name = kwargs['service_name'] + self.action = kwargs['action'] + + +class OrchestrationServiceSummary(msrest.serialization.Model): + """Summary for an orchestration service of a virtual machine scale set. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar service_name: The name of the service. Possible values include: "AutomaticRepairs", + "DummyOrchestrationServiceName". + :vartype service_name: str or ~azure.mgmt.compute.v2021_03_01.models.OrchestrationServiceNames + :ivar service_state: The current state of the service. Possible values include: "NotRunning", + "Running", "Suspended". + :vartype service_state: str or ~azure.mgmt.compute.v2021_03_01.models.OrchestrationServiceState + """ + + _validation = { + 'service_name': {'readonly': True}, + 'service_state': {'readonly': True}, + } + + _attribute_map = { + 'service_name': {'key': 'serviceName', 'type': 'str'}, + 'service_state': {'key': 'serviceState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OrchestrationServiceSummary, self).__init__(**kwargs) + self.service_name = None + self.service_state = None + + +class OSDisk(msrest.serialization.Model): + """Specifies information about the operating system disk used by the virtual machine. :code:`
`:code:`
` For more information about disks, see `About disks and VHDs for Azure virtual machines `_. + + All required parameters must be populated in order to send to Azure. + + :param os_type: This property allows you to specify the type of the OS that is included in the + disk if creating a VM from user-image or a specialized VHD. :code:`
`:code:`
` Possible + values are: :code:`
`:code:`
` **Windows** :code:`
`:code:`
` **Linux**. Possible + values include: "Windows", "Linux". + :type os_type: str or ~azure.mgmt.compute.v2021_03_01.models.OperatingSystemTypes + :param encryption_settings: Specifies the encryption settings for the OS Disk. + :code:`
`:code:`
` Minimum api-version: 2015-06-15. + :type encryption_settings: ~azure.mgmt.compute.v2021_03_01.models.DiskEncryptionSettings + :param name: The disk name. + :type name: str + :param vhd: The virtual hard disk. + :type vhd: ~azure.mgmt.compute.v2021_03_01.models.VirtualHardDisk + :param image: The source user image virtual hard disk. The virtual hard disk will be copied + before being attached to the virtual machine. If SourceImage is provided, the destination + virtual hard drive must not exist. + :type image: ~azure.mgmt.compute.v2021_03_01.models.VirtualHardDisk + :param caching: Specifies the caching requirements. :code:`
`:code:`
` Possible values + are: :code:`
`:code:`
` **None** :code:`
`:code:`
` **ReadOnly** + :code:`
`:code:`
` **ReadWrite** :code:`
`:code:`
` Default: **None** for Standard + storage. **ReadOnly** for Premium storage. Possible values include: "None", "ReadOnly", + "ReadWrite". + :type caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes + :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :type write_accelerator_enabled: bool + :param diff_disk_settings: Specifies the ephemeral Disk Settings for the operating system disk + used by the virtual machine. + :type diff_disk_settings: ~azure.mgmt.compute.v2021_03_01.models.DiffDiskSettings + :param create_option: Required. Specifies how the virtual machine should be + created.:code:`
`:code:`
` Possible values are::code:`
`:code:`
` **Attach** \u2013 + This value is used when you are using a specialized disk to create the virtual + machine.:code:`
`:code:`
` **FromImage** \u2013 This value is used when you are using an + image to create the virtual machine. If you are using a platform image, you also use the + imageReference element described above. If you are using a marketplace image, you also use the + plan element previously described. Possible values include: "FromImage", "Empty", "Attach". + :type create_option: str or ~azure.mgmt.compute.v2021_03_01.models.DiskCreateOptionTypes + :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + used to overwrite the size of the disk in a virtual machine image. :code:`
`:code:`
` + This value cannot be larger than 1023 GB. + :type disk_size_gb: int + :param managed_disk: The managed disk parameters. + :type managed_disk: ~azure.mgmt.compute.v2021_03_01.models.ManagedDiskParameters + """ + + _validation = { + 'create_option': {'required': True}, + } + + _attribute_map = { + 'os_type': {'key': 'osType', 'type': 'str'}, + 'encryption_settings': {'key': 'encryptionSettings', 'type': 'DiskEncryptionSettings'}, + 'name': {'key': 'name', 'type': 'str'}, + 'vhd': {'key': 'vhd', 'type': 'VirtualHardDisk'}, + 'image': {'key': 'image', 'type': 'VirtualHardDisk'}, + 'caching': {'key': 'caching', 'type': 'str'}, + 'write_accelerator_enabled': {'key': 'writeAcceleratorEnabled', 'type': 'bool'}, + 'diff_disk_settings': {'key': 'diffDiskSettings', 'type': 'DiffDiskSettings'}, + 'create_option': {'key': 'createOption', 'type': 'str'}, + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, + 'managed_disk': {'key': 'managedDisk', 'type': 'ManagedDiskParameters'}, + } + + def __init__( + self, + **kwargs + ): + super(OSDisk, self).__init__(**kwargs) + self.os_type = kwargs.get('os_type', None) + self.encryption_settings = kwargs.get('encryption_settings', None) + self.name = kwargs.get('name', None) + self.vhd = kwargs.get('vhd', None) + self.image = kwargs.get('image', None) + self.caching = kwargs.get('caching', None) + self.write_accelerator_enabled = kwargs.get('write_accelerator_enabled', None) + self.diff_disk_settings = kwargs.get('diff_disk_settings', None) + self.create_option = kwargs['create_option'] + self.disk_size_gb = kwargs.get('disk_size_gb', None) + self.managed_disk = kwargs.get('managed_disk', None) + + +class OSDiskImage(msrest.serialization.Model): + """Contains the os disk image information. + + All required parameters must be populated in order to send to Azure. + + :param operating_system: Required. The operating system of the osDiskImage. Possible values + include: "Windows", "Linux". + :type operating_system: str or ~azure.mgmt.compute.v2021_03_01.models.OperatingSystemTypes + """ + + _validation = { + 'operating_system': {'required': True}, + } + + _attribute_map = { + 'operating_system': {'key': 'operatingSystem', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OSDiskImage, self).__init__(**kwargs) + self.operating_system = kwargs['operating_system'] + + +class OSFamily(msrest.serialization.Model): + """Describes a cloud service OS family. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :param properties: OS family properties. + :type properties: ~azure.mgmt.compute.v2021_03_01.models.OSFamilyProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'OSFamilyProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(OSFamily, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = None + self.properties = kwargs.get('properties', None) + + +class OSFamilyListResult(msrest.serialization.Model): + """OSFamilyListResult. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.OSFamily] + :param next_link: + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OSFamily]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OSFamilyListResult, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = kwargs.get('next_link', None) + + +class OSFamilyProperties(msrest.serialization.Model): + """OS family properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The OS family name. + :vartype name: str + :ivar label: The OS family label. + :vartype label: str + :ivar versions: List of OS versions belonging to this family. + :vartype versions: list[~azure.mgmt.compute.v2021_03_01.models.OSVersionPropertiesBase] + """ + + _validation = { + 'name': {'readonly': True}, + 'label': {'readonly': True}, + 'versions': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'label': {'key': 'label', 'type': 'str'}, + 'versions': {'key': 'versions', 'type': '[OSVersionPropertiesBase]'}, + } + + def __init__( + self, + **kwargs + ): + super(OSFamilyProperties, self).__init__(**kwargs) + self.name = None + self.label = None + self.versions = None + + +class OSProfile(msrest.serialization.Model): + """Specifies the operating system settings for the virtual machine. Some of the settings cannot be changed once VM is provisioned. + + :param computer_name: Specifies the host OS name of the virtual machine. + :code:`
`:code:`
` This name cannot be updated after the VM is created. + :code:`
`:code:`
` **Max-length (Windows):** 15 characters :code:`
`:code:`
` + **Max-length (Linux):** 64 characters. :code:`
`:code:`
` For naming conventions and + restrictions see `Azure infrastructure services implementation guidelines + `_. + :type computer_name: str + :param admin_username: Specifies the name of the administrator account. + :code:`
`:code:`
` This property cannot be updated after the VM is created. + :code:`
`:code:`
` **Windows-only restriction:** Cannot end in "." + :code:`
`:code:`
` **Disallowed values:** "administrator", "admin", "user", "user1", + "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", + "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", + "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". + :code:`
`:code:`
` **Minimum-length (Linux):** 1 character :code:`
`:code:`
` + **Max-length (Linux):** 64 characters :code:`
`:code:`
` **Max-length (Windows):** 20 + characters :code:`
`:code:`
`:code:`
  • ` For root access to the Linux VM, see `Using + root privileges on Linux virtual machines in Azure `_\ :code:`
    `:code:`
  • ` For a list of built-in system users on + Linux that should not be used in this field, see `Selecting User Names for Linux on Azure + `_. + :type admin_username: str + :param admin_password: Specifies the password of the administrator account. + :code:`
    `:code:`
    ` **Minimum-length (Windows):** 8 characters :code:`
    `:code:`
    ` + **Minimum-length (Linux):** 6 characters :code:`
    `:code:`
    ` **Max-length (Windows):** 123 + characters :code:`
    `:code:`
    ` **Max-length (Linux):** 72 characters + :code:`
    `:code:`
    ` **Complexity requirements:** 3 out of 4 conditions below need to be + fulfilled :code:`
    ` Has lower characters :code:`
    `Has upper characters :code:`
    ` Has a + digit :code:`
    ` Has a special character (Regex match [\W_]) :code:`
    `:code:`
    ` + **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", + "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" :code:`
    `:code:`
    ` For + resetting the password, see `How to reset the Remote Desktop service or its login password in a + Windows VM `_ :code:`
    `:code:`
    ` For + resetting root password, see `Manage users, SSH, and check or repair disks on Azure Linux VMs + using the VMAccess Extension `_. + :type admin_password: str + :param custom_data: Specifies a base-64 encoded string of custom data. The base-64 encoded + string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum + length of the binary array is 65535 bytes. :code:`
    `:code:`
    ` **Note: Do not pass any + secrets or passwords in customData property** :code:`
    `:code:`
    ` This property cannot be + updated after the VM is created. :code:`
    `:code:`
    ` customData is passed to the VM to be + saved as a file, for more information see `Custom Data on Azure VMs + `_ + :code:`
    `:code:`
    ` For using cloud-init for your Linux VM, see `Using cloud-init to + customize a Linux VM during creation `_. + :type custom_data: str + :param windows_configuration: Specifies Windows operating system settings on the virtual + machine. + :type windows_configuration: ~azure.mgmt.compute.v2021_03_01.models.WindowsConfiguration + :param linux_configuration: Specifies the Linux operating system settings on the virtual + machine. :code:`
    `:code:`
    `For a list of supported Linux distributions, see `Linux on + Azure-Endorsed Distributions `_ + :code:`
    `:code:`
    ` For running non-endorsed distributions, see `Information for Non- + Endorsed Distributions `_. + :type linux_configuration: ~azure.mgmt.compute.v2021_03_01.models.LinuxConfiguration + :param secrets: Specifies set of certificates that should be installed onto the virtual + machine. + :type secrets: list[~azure.mgmt.compute.v2021_03_01.models.VaultSecretGroup] + :param allow_extension_operations: Specifies whether extension operations should be allowed on + the virtual machine. :code:`
    `:code:`
    `This may only be set to False when no extensions + are present on the virtual machine. + :type allow_extension_operations: bool + :param require_guest_provision_signal: Specifies whether the guest provision signal is required + to infer provision success of the virtual machine. **Note: This property is for private + testing only, and all customers must not set the property to false.**. + :type require_guest_provision_signal: bool + """ + + _attribute_map = { + 'computer_name': {'key': 'computerName', 'type': 'str'}, + 'admin_username': {'key': 'adminUsername', 'type': 'str'}, + 'admin_password': {'key': 'adminPassword', 'type': 'str'}, + 'custom_data': {'key': 'customData', 'type': 'str'}, + 'windows_configuration': {'key': 'windowsConfiguration', 'type': 'WindowsConfiguration'}, + 'linux_configuration': {'key': 'linuxConfiguration', 'type': 'LinuxConfiguration'}, + 'secrets': {'key': 'secrets', 'type': '[VaultSecretGroup]'}, + 'allow_extension_operations': {'key': 'allowExtensionOperations', 'type': 'bool'}, + 'require_guest_provision_signal': {'key': 'requireGuestProvisionSignal', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(OSProfile, self).__init__(**kwargs) + self.computer_name = kwargs.get('computer_name', None) + self.admin_username = kwargs.get('admin_username', None) + self.admin_password = kwargs.get('admin_password', None) + self.custom_data = kwargs.get('custom_data', None) + self.windows_configuration = kwargs.get('windows_configuration', None) + self.linux_configuration = kwargs.get('linux_configuration', None) + self.secrets = kwargs.get('secrets', None) + self.allow_extension_operations = kwargs.get('allow_extension_operations', None) + self.require_guest_provision_signal = kwargs.get('require_guest_provision_signal', None) + + +class OSVersion(msrest.serialization.Model): + """Describes a cloud service OS version. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :param properties: OS version properties. + :type properties: ~azure.mgmt.compute.v2021_03_01.models.OSVersionProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'OSVersionProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(OSVersion, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = None + self.properties = kwargs.get('properties', None) + + +class OSVersionListResult(msrest.serialization.Model): + """OSVersionListResult. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.OSVersion] + :param next_link: + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OSVersion]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OSVersionListResult, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = kwargs.get('next_link', None) class OSVersionProperties(msrest.serialization.Model): @@ -1099,196 +3802,5854 @@ class OSVersionProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar family: The family of this OS version. - :vartype family: str - :ivar family_label: The family label of this OS version. - :vartype family_label: str - :ivar version: The OS version. - :vartype version: str - :ivar label: The OS version label. - :vartype label: str - :ivar is_default: Specifies whether this is the default OS version for its family. - :vartype is_default: bool - :ivar is_active: Specifies whether this OS version is active. - :vartype is_active: bool + :ivar family: The family of this OS version. + :vartype family: str + :ivar family_label: The family label of this OS version. + :vartype family_label: str + :ivar version: The OS version. + :vartype version: str + :ivar label: The OS version label. + :vartype label: str + :ivar is_default: Specifies whether this is the default OS version for its family. + :vartype is_default: bool + :ivar is_active: Specifies whether this OS version is active. + :vartype is_active: bool + """ + + _validation = { + 'family': {'readonly': True}, + 'family_label': {'readonly': True}, + 'version': {'readonly': True}, + 'label': {'readonly': True}, + 'is_default': {'readonly': True}, + 'is_active': {'readonly': True}, + } + + _attribute_map = { + 'family': {'key': 'family', 'type': 'str'}, + 'family_label': {'key': 'familyLabel', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'label': {'key': 'label', 'type': 'str'}, + 'is_default': {'key': 'isDefault', 'type': 'bool'}, + 'is_active': {'key': 'isActive', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(OSVersionProperties, self).__init__(**kwargs) + self.family = None + self.family_label = None + self.version = None + self.label = None + self.is_default = None + self.is_active = None + + +class OSVersionPropertiesBase(msrest.serialization.Model): + """Configuration view of an OS version. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar version: The OS version. + :vartype version: str + :ivar label: The OS version label. + :vartype label: str + :ivar is_default: Specifies whether this is the default OS version for its family. + :vartype is_default: bool + :ivar is_active: Specifies whether this OS version is active. + :vartype is_active: bool + """ + + _validation = { + 'version': {'readonly': True}, + 'label': {'readonly': True}, + 'is_default': {'readonly': True}, + 'is_active': {'readonly': True}, + } + + _attribute_map = { + 'version': {'key': 'version', 'type': 'str'}, + 'label': {'key': 'label', 'type': 'str'}, + 'is_default': {'key': 'isDefault', 'type': 'bool'}, + 'is_active': {'key': 'isActive', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(OSVersionPropertiesBase, self).__init__(**kwargs) + self.version = None + self.label = None + self.is_default = None + self.is_active = None + + +class PatchInstallationDetail(msrest.serialization.Model): + """Information about a specific patch that was encountered during an installation action. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar patch_id: A unique identifier for the patch. + :vartype patch_id: str + :ivar name: The friendly name of the patch. + :vartype name: str + :ivar version: The version string of the package. It may conform to Semantic Versioning. Only + applies to Linux. + :vartype version: str + :ivar kb_id: The KBID of the patch. Only applies to Windows patches. + :vartype kb_id: str + :ivar classifications: The classification(s) of the patch as provided by the patch publisher. + :vartype classifications: list[str] + :ivar installation_state: The state of the patch after the installation operation completed. + Possible values include: "Unknown", "Installed", "Failed", "Excluded", "NotSelected", + "Pending". + :vartype installation_state: str or + ~azure.mgmt.compute.v2021_03_01.models.PatchInstallationState + """ + + _validation = { + 'patch_id': {'readonly': True}, + 'name': {'readonly': True}, + 'version': {'readonly': True}, + 'kb_id': {'readonly': True}, + 'classifications': {'readonly': True}, + 'installation_state': {'readonly': True}, + } + + _attribute_map = { + 'patch_id': {'key': 'patchId', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'kb_id': {'key': 'kbId', 'type': 'str'}, + 'classifications': {'key': 'classifications', 'type': '[str]'}, + 'installation_state': {'key': 'installationState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PatchInstallationDetail, self).__init__(**kwargs) + self.patch_id = None + self.name = None + self.version = None + self.kb_id = None + self.classifications = None + self.installation_state = None + + +class PatchSettings(msrest.serialization.Model): + """Specifies settings related to VM Guest Patching on Windows. + + :param patch_mode: Specifies the mode of VM Guest Patching to IaaS virtual machine.:code:`
    `:code:`
    ` Possible values are::code:`
    `:code:`
    ` **Manual** - You control + the application of patches to a virtual machine. You do this by applying patches manually + inside the VM. In this mode, automatic updates are disabled; the property + WindowsConfiguration.enableAutomaticUpdates must be false:code:`
    `:code:`
    ` + **AutomaticByOS** - The virtual machine will automatically be updated by the OS. The property + WindowsConfiguration.enableAutomaticUpdates must be true. :code:`
    `:code:`
    ` + **AutomaticByPlatform** - the virtual machine will automatically updated by the platform. The + properties provisionVMAgent and WindowsConfiguration.enableAutomaticUpdates must be true. + Possible values include: "Manual", "AutomaticByOS", "AutomaticByPlatform". + :type patch_mode: str or ~azure.mgmt.compute.v2021_03_01.models.WindowsVMGuestPatchMode + :param enable_hotpatching: Enables customers to patch their Azure VMs without requiring a + reboot. For enableHotpatching, the 'provisionVMAgent' must be set to true and 'patchMode' must + be set to 'AutomaticByPlatform'. + :type enable_hotpatching: bool + """ + + _attribute_map = { + 'patch_mode': {'key': 'patchMode', 'type': 'str'}, + 'enable_hotpatching': {'key': 'enableHotpatching', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(PatchSettings, self).__init__(**kwargs) + self.patch_mode = kwargs.get('patch_mode', None) + self.enable_hotpatching = kwargs.get('enable_hotpatching', None) + + +class Plan(msrest.serialization.Model): + """Specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click **Save**. + + :param name: The plan ID. + :type name: str + :param publisher: The publisher ID. + :type publisher: str + :param product: Specifies the product of the image from the marketplace. This is the same value + as Offer under the imageReference element. + :type product: str + :param promotion_code: The promotion code. + :type promotion_code: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'product': {'key': 'product', 'type': 'str'}, + 'promotion_code': {'key': 'promotionCode', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Plan, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.publisher = kwargs.get('publisher', None) + self.product = kwargs.get('product', None) + self.promotion_code = kwargs.get('promotion_code', None) + + +class ProximityPlacementGroup(Resource): + """Specifies information about the proximity placement group. + + 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 id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param proximity_placement_group_type: Specifies the type of the proximity placement group. + :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` **Standard** : Co-locate + resources within an Azure region or Availability Zone. :code:`
    `:code:`
    ` **Ultra** : For + future use. Possible values include: "Standard", "Ultra". + :type proximity_placement_group_type: str or + ~azure.mgmt.compute.v2021_03_01.models.ProximityPlacementGroupType + :ivar virtual_machines: A list of references to all virtual machines in the proximity placement + group. + :vartype virtual_machines: + list[~azure.mgmt.compute.v2021_03_01.models.SubResourceWithColocationStatus] + :ivar virtual_machine_scale_sets: A list of references to all virtual machine scale sets in the + proximity placement group. + :vartype virtual_machine_scale_sets: + list[~azure.mgmt.compute.v2021_03_01.models.SubResourceWithColocationStatus] + :ivar availability_sets: A list of references to all availability sets in the proximity + placement group. + :vartype availability_sets: + list[~azure.mgmt.compute.v2021_03_01.models.SubResourceWithColocationStatus] + :param colocation_status: Describes colocation status of the Proximity Placement Group. + :type colocation_status: ~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'virtual_machines': {'readonly': True}, + 'virtual_machine_scale_sets': {'readonly': True}, + 'availability_sets': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'proximity_placement_group_type': {'key': 'properties.proximityPlacementGroupType', 'type': 'str'}, + 'virtual_machines': {'key': 'properties.virtualMachines', 'type': '[SubResourceWithColocationStatus]'}, + 'virtual_machine_scale_sets': {'key': 'properties.virtualMachineScaleSets', 'type': '[SubResourceWithColocationStatus]'}, + 'availability_sets': {'key': 'properties.availabilitySets', 'type': '[SubResourceWithColocationStatus]'}, + 'colocation_status': {'key': 'properties.colocationStatus', 'type': 'InstanceViewStatus'}, + } + + def __init__( + self, + **kwargs + ): + super(ProximityPlacementGroup, self).__init__(**kwargs) + self.proximity_placement_group_type = kwargs.get('proximity_placement_group_type', None) + self.virtual_machines = None + self.virtual_machine_scale_sets = None + self.availability_sets = None + self.colocation_status = kwargs.get('colocation_status', None) + + +class ProximityPlacementGroupListResult(msrest.serialization.Model): + """The List Proximity Placement Group operation response. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. The list of proximity placement groups. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.ProximityPlacementGroup] + :param next_link: The URI to fetch the next page of proximity placement groups. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ProximityPlacementGroup]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProximityPlacementGroupListResult, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = kwargs.get('next_link', None) + + +class ProximityPlacementGroupUpdate(UpdateResource): + """Specifies information about the proximity placement group. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(ProximityPlacementGroupUpdate, self).__init__(**kwargs) + + +class PurchasePlan(msrest.serialization.Model): + """Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. + + All required parameters must be populated in order to send to Azure. + + :param publisher: Required. The publisher ID. + :type publisher: str + :param name: Required. The plan ID. + :type name: str + :param product: Required. Specifies the product of the image from the marketplace. This is the + same value as Offer under the imageReference element. + :type product: str + """ + + _validation = { + 'publisher': {'required': True}, + 'name': {'required': True}, + 'product': {'required': True}, + } + + _attribute_map = { + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'product': {'key': 'product', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PurchasePlan, self).__init__(**kwargs) + self.publisher = kwargs['publisher'] + self.name = kwargs['name'] + self.product = kwargs['product'] + + +class RecoveryWalkResponse(msrest.serialization.Model): + """Response after calling a manual recovery walk. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar walk_performed: Whether the recovery walk was performed. + :vartype walk_performed: bool + :ivar next_platform_update_domain: The next update domain that needs to be walked. Null means + walk spanning all update domains has been completed. + :vartype next_platform_update_domain: int + """ + + _validation = { + 'walk_performed': {'readonly': True}, + 'next_platform_update_domain': {'readonly': True}, + } + + _attribute_map = { + 'walk_performed': {'key': 'walkPerformed', 'type': 'bool'}, + 'next_platform_update_domain': {'key': 'nextPlatformUpdateDomain', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(RecoveryWalkResponse, self).__init__(**kwargs) + self.walk_performed = None + self.next_platform_update_domain = None + + +class RequestRateByIntervalInput(LogAnalyticsInputBase): + """Api request input for LogAnalytics getRequestRateByInterval Api. + + All required parameters must be populated in order to send to Azure. + + :param blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :type blob_container_sas_uri: str + :param from_time: Required. From time of the query. + :type from_time: ~datetime.datetime + :param to_time: Required. To time of the query. + :type to_time: ~datetime.datetime + :param group_by_throttle_policy: Group query result by Throttle Policy applied. + :type group_by_throttle_policy: bool + :param group_by_operation_name: Group query result by Operation Name. + :type group_by_operation_name: bool + :param group_by_resource_name: Group query result by Resource Name. + :type group_by_resource_name: bool + :param group_by_client_application_id: Group query result by Client Application ID. + :type group_by_client_application_id: bool + :param group_by_user_agent: Group query result by User Agent. + :type group_by_user_agent: bool + :param interval_length: Required. Interval value in minutes used to create LogAnalytics call + rate logs. Possible values include: "ThreeMins", "FiveMins", "ThirtyMins", "SixtyMins". + :type interval_length: str or ~azure.mgmt.compute.v2021_03_01.models.IntervalInMins + """ + + _validation = { + 'blob_container_sas_uri': {'required': True}, + 'from_time': {'required': True}, + 'to_time': {'required': True}, + 'interval_length': {'required': True}, + } + + _attribute_map = { + 'blob_container_sas_uri': {'key': 'blobContainerSasUri', 'type': 'str'}, + 'from_time': {'key': 'fromTime', 'type': 'iso-8601'}, + 'to_time': {'key': 'toTime', 'type': 'iso-8601'}, + 'group_by_throttle_policy': {'key': 'groupByThrottlePolicy', 'type': 'bool'}, + 'group_by_operation_name': {'key': 'groupByOperationName', 'type': 'bool'}, + 'group_by_resource_name': {'key': 'groupByResourceName', 'type': 'bool'}, + 'group_by_client_application_id': {'key': 'groupByClientApplicationId', 'type': 'bool'}, + 'group_by_user_agent': {'key': 'groupByUserAgent', 'type': 'bool'}, + 'interval_length': {'key': 'intervalLength', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RequestRateByIntervalInput, self).__init__(**kwargs) + self.interval_length = kwargs['interval_length'] + + +class ResourceInstanceViewStatus(msrest.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 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 + :param level: The level code. Possible values include: "Info", "Warning", "Error". + :type level: str or ~azure.mgmt.compute.v2021_03_01.models.StatusLevelTypes + """ + + _validation = { + 'code': {'readonly': True}, + 'display_status': {'readonly': True}, + 'message': {'readonly': True}, + 'time': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'display_status': {'key': 'displayStatus', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'time': {'key': 'time', 'type': 'iso-8601'}, + 'level': {'key': 'level', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceInstanceViewStatus, self).__init__(**kwargs) + self.code = None + self.display_status = None + self.message = None + self.time = None + self.level = kwargs.get('level', None) + + +class RetrieveBootDiagnosticsDataResult(msrest.serialization.Model): + """The SAS URIs of the console screenshot and serial log blobs. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar console_screenshot_blob_uri: The console screenshot blob URI. + :vartype console_screenshot_blob_uri: str + :ivar serial_console_log_blob_uri: The serial console log blob URI. + :vartype serial_console_log_blob_uri: str + """ + + _validation = { + 'console_screenshot_blob_uri': {'readonly': True}, + 'serial_console_log_blob_uri': {'readonly': True}, + } + + _attribute_map = { + 'console_screenshot_blob_uri': {'key': 'consoleScreenshotBlobUri', 'type': 'str'}, + 'serial_console_log_blob_uri': {'key': 'serialConsoleLogBlobUri', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RetrieveBootDiagnosticsDataResult, self).__init__(**kwargs) + self.console_screenshot_blob_uri = None + self.serial_console_log_blob_uri = None + + +class RoleInstance(msrest.serialization.Model): + """RoleInstance. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource Name. + :vartype name: str + :ivar type: Resource Type. + :vartype type: str + :ivar location: Resource Location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :param sku: + :type sku: ~azure.mgmt.compute.v2021_03_01.models.InstanceSku + :param properties: + :type properties: ~azure.mgmt.compute.v2021_03_01.models.RoleInstanceProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'InstanceSku'}, + 'properties': {'key': 'properties', 'type': 'RoleInstanceProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(RoleInstance, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = None + self.tags = None + self.sku = kwargs.get('sku', None) + self.properties = kwargs.get('properties', None) + + +class RoleInstanceListResult(msrest.serialization.Model): + """RoleInstanceListResult. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.RoleInstance] + :param next_link: + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[RoleInstance]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RoleInstanceListResult, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = kwargs.get('next_link', None) + + +class RoleInstanceNetworkProfile(msrest.serialization.Model): + """Describes the network profile for the role instance. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar network_interfaces: Specifies the list of resource Ids for the network interfaces + associated with the role instance. + :vartype network_interfaces: list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + """ + + _validation = { + 'network_interfaces': {'readonly': True}, + } + + _attribute_map = { + 'network_interfaces': {'key': 'networkInterfaces', 'type': '[SubResource]'}, + } + + def __init__( + self, + **kwargs + ): + super(RoleInstanceNetworkProfile, self).__init__(**kwargs) + self.network_interfaces = None + + +class RoleInstanceProperties(msrest.serialization.Model): + """RoleInstanceProperties. + + :param network_profile: Describes the network profile for the role instance. + :type network_profile: ~azure.mgmt.compute.v2021_03_01.models.RoleInstanceNetworkProfile + :param instance_view: The instance view of the role instance. + :type instance_view: ~azure.mgmt.compute.v2021_03_01.models.RoleInstanceView + """ + + _attribute_map = { + 'network_profile': {'key': 'networkProfile', 'type': 'RoleInstanceNetworkProfile'}, + 'instance_view': {'key': 'instanceView', 'type': 'RoleInstanceView'}, + } + + def __init__( + self, + **kwargs + ): + super(RoleInstanceProperties, self).__init__(**kwargs) + self.network_profile = kwargs.get('network_profile', None) + self.instance_view = kwargs.get('instance_view', None) + + +class RoleInstances(msrest.serialization.Model): + """Specifies a list of role instances from the cloud service. + + All required parameters must be populated in order to send to Azure. + + :param role_instances: Required. List of cloud service role instance names. Value of '*' will + signify all role instances of the cloud service. + :type role_instances: list[str] + """ + + _validation = { + 'role_instances': {'required': True}, + } + + _attribute_map = { + 'role_instances': {'key': 'roleInstances', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(RoleInstances, self).__init__(**kwargs) + self.role_instances = kwargs['role_instances'] + + +class RoleInstanceView(msrest.serialization.Model): + """The instance view of the role instance. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar platform_update_domain: The Update Domain. + :vartype platform_update_domain: int + :ivar platform_fault_domain: The Fault Domain. + :vartype platform_fault_domain: int + :ivar private_id: Specifies a unique identifier generated internally for the cloud service + associated with this role instance. :code:`
    `:code:`
    ` NOTE: If you are using Azure + Diagnostics extension, this property can be used as 'DeploymentId' for querying details. + :vartype private_id: str + :ivar statuses: + :vartype statuses: list[~azure.mgmt.compute.v2021_03_01.models.ResourceInstanceViewStatus] + """ + + _validation = { + 'platform_update_domain': {'readonly': True}, + 'platform_fault_domain': {'readonly': True}, + 'private_id': {'readonly': True}, + 'statuses': {'readonly': True}, + } + + _attribute_map = { + 'platform_update_domain': {'key': 'platformUpdateDomain', 'type': 'int'}, + 'platform_fault_domain': {'key': 'platformFaultDomain', 'type': 'int'}, + 'private_id': {'key': 'privateId', 'type': 'str'}, + 'statuses': {'key': 'statuses', 'type': '[ResourceInstanceViewStatus]'}, + } + + def __init__( + self, + **kwargs + ): + super(RoleInstanceView, self).__init__(**kwargs) + self.platform_update_domain = None + self.platform_fault_domain = None + self.private_id = None + self.statuses = None + + +class RollbackStatusInfo(msrest.serialization.Model): + """Information about rollback on failed VM instances after a OS Upgrade operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar successfully_rolledback_instance_count: The number of instances which have been + successfully rolled back. + :vartype successfully_rolledback_instance_count: int + :ivar failed_rolledback_instance_count: The number of instances which failed to rollback. + :vartype failed_rolledback_instance_count: int + :ivar rollback_error: Error details if OS rollback failed. + :vartype rollback_error: ~azure.mgmt.compute.v2021_03_01.models.ApiError + """ + + _validation = { + 'successfully_rolledback_instance_count': {'readonly': True}, + 'failed_rolledback_instance_count': {'readonly': True}, + 'rollback_error': {'readonly': True}, + } + + _attribute_map = { + 'successfully_rolledback_instance_count': {'key': 'successfullyRolledbackInstanceCount', 'type': 'int'}, + 'failed_rolledback_instance_count': {'key': 'failedRolledbackInstanceCount', 'type': 'int'}, + 'rollback_error': {'key': 'rollbackError', 'type': 'ApiError'}, + } + + def __init__( + self, + **kwargs + ): + super(RollbackStatusInfo, self).__init__(**kwargs) + self.successfully_rolledback_instance_count = None + self.failed_rolledback_instance_count = None + self.rollback_error = None + + +class RollingUpgradePolicy(msrest.serialization.Model): + """The configuration parameters used while performing a rolling upgrade. + + :param max_batch_instance_percent: The maximum percent of total virtual machine instances that + will be upgraded simultaneously by the rolling upgrade in one batch. As this is a maximum, + unhealthy instances in previous or future batches can cause the percentage of instances in a + batch to decrease to ensure higher reliability. The default value for this parameter is 20%. + :type max_batch_instance_percent: int + :param max_unhealthy_instance_percent: The maximum percentage of the total virtual machine + instances in the scale set that can be simultaneously unhealthy, either as a result of being + upgraded, or by being found in an unhealthy state by the virtual machine health checks before + the rolling upgrade aborts. This constraint will be checked prior to starting any batch. The + default value for this parameter is 20%. + :type max_unhealthy_instance_percent: int + :param max_unhealthy_upgraded_instance_percent: The maximum percentage of upgraded virtual + machine instances that can be found to be in an unhealthy state. This check will happen after + each batch is upgraded. If this percentage is ever exceeded, the rolling update aborts. The + default value for this parameter is 20%. + :type max_unhealthy_upgraded_instance_percent: int + :param pause_time_between_batches: The wait time between completing the update for all virtual + machines in one batch and starting the next batch. The time duration should be specified in ISO + 8601 format. The default value is 0 seconds (PT0S). + :type pause_time_between_batches: str + :param enable_cross_zone_upgrade: Allow VMSS to ignore AZ boundaries when constructing upgrade + batches. Take into consideration the Update Domain and maxBatchInstancePercent to determine the + batch size. + :type enable_cross_zone_upgrade: bool + :param prioritize_unhealthy_instances: Upgrade all unhealthy instances in a scale set before + any healthy instances. + :type prioritize_unhealthy_instances: bool + """ + + _validation = { + 'max_batch_instance_percent': {'maximum': 100, 'minimum': 5}, + 'max_unhealthy_instance_percent': {'maximum': 100, 'minimum': 5}, + 'max_unhealthy_upgraded_instance_percent': {'maximum': 100, 'minimum': 0}, + } + + _attribute_map = { + 'max_batch_instance_percent': {'key': 'maxBatchInstancePercent', 'type': 'int'}, + 'max_unhealthy_instance_percent': {'key': 'maxUnhealthyInstancePercent', 'type': 'int'}, + 'max_unhealthy_upgraded_instance_percent': {'key': 'maxUnhealthyUpgradedInstancePercent', 'type': 'int'}, + 'pause_time_between_batches': {'key': 'pauseTimeBetweenBatches', 'type': 'str'}, + 'enable_cross_zone_upgrade': {'key': 'enableCrossZoneUpgrade', 'type': 'bool'}, + 'prioritize_unhealthy_instances': {'key': 'prioritizeUnhealthyInstances', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(RollingUpgradePolicy, self).__init__(**kwargs) + self.max_batch_instance_percent = kwargs.get('max_batch_instance_percent', None) + self.max_unhealthy_instance_percent = kwargs.get('max_unhealthy_instance_percent', None) + self.max_unhealthy_upgraded_instance_percent = kwargs.get('max_unhealthy_upgraded_instance_percent', None) + self.pause_time_between_batches = kwargs.get('pause_time_between_batches', None) + self.enable_cross_zone_upgrade = kwargs.get('enable_cross_zone_upgrade', None) + self.prioritize_unhealthy_instances = kwargs.get('prioritize_unhealthy_instances', None) + + +class RollingUpgradeProgressInfo(msrest.serialization.Model): + """Information about the number of virtual machine instances in each upgrade state. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar successful_instance_count: The number of instances that have been successfully upgraded. + :vartype successful_instance_count: int + :ivar failed_instance_count: The number of instances that have failed to be upgraded + successfully. + :vartype failed_instance_count: int + :ivar in_progress_instance_count: The number of instances that are currently being upgraded. + :vartype in_progress_instance_count: int + :ivar pending_instance_count: The number of instances that have not yet begun to be upgraded. + :vartype pending_instance_count: int + """ + + _validation = { + 'successful_instance_count': {'readonly': True}, + 'failed_instance_count': {'readonly': True}, + 'in_progress_instance_count': {'readonly': True}, + 'pending_instance_count': {'readonly': True}, + } + + _attribute_map = { + 'successful_instance_count': {'key': 'successfulInstanceCount', 'type': 'int'}, + 'failed_instance_count': {'key': 'failedInstanceCount', 'type': 'int'}, + 'in_progress_instance_count': {'key': 'inProgressInstanceCount', 'type': 'int'}, + 'pending_instance_count': {'key': 'pendingInstanceCount', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(RollingUpgradeProgressInfo, self).__init__(**kwargs) + self.successful_instance_count = None + self.failed_instance_count = None + self.in_progress_instance_count = None + self.pending_instance_count = None + + +class RollingUpgradeRunningStatus(msrest.serialization.Model): + """Information about the current running state of the overall upgrade. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Code indicating the current status of the upgrade. Possible values include: + "RollingForward", "Cancelled", "Completed", "Faulted". + :vartype code: str or ~azure.mgmt.compute.v2021_03_01.models.RollingUpgradeStatusCode + :ivar start_time: Start time of the upgrade. + :vartype start_time: ~datetime.datetime + :ivar last_action: The last action performed on the rolling upgrade. Possible values include: + "Start", "Cancel". + :vartype last_action: str or ~azure.mgmt.compute.v2021_03_01.models.RollingUpgradeActionType + :ivar last_action_time: Last action time of the upgrade. + :vartype last_action_time: ~datetime.datetime + """ + + _validation = { + 'code': {'readonly': True}, + 'start_time': {'readonly': True}, + 'last_action': {'readonly': True}, + 'last_action_time': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'last_action': {'key': 'lastAction', 'type': 'str'}, + 'last_action_time': {'key': 'lastActionTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(RollingUpgradeRunningStatus, self).__init__(**kwargs) + self.code = None + self.start_time = None + self.last_action = None + self.last_action_time = None + + +class RollingUpgradeStatusInfo(Resource): + """The status of the latest virtual machine scale set rolling upgrade. + + 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 id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :ivar policy: The rolling upgrade policies applied for this upgrade. + :vartype policy: ~azure.mgmt.compute.v2021_03_01.models.RollingUpgradePolicy + :ivar running_status: Information about the current running state of the overall upgrade. + :vartype running_status: ~azure.mgmt.compute.v2021_03_01.models.RollingUpgradeRunningStatus + :ivar progress: Information about the number of virtual machine instances in each upgrade + state. + :vartype progress: ~azure.mgmt.compute.v2021_03_01.models.RollingUpgradeProgressInfo + :ivar error: Error details for this upgrade, if there are any. + :vartype error: ~azure.mgmt.compute.v2021_03_01.models.ApiError + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'policy': {'readonly': True}, + 'running_status': {'readonly': True}, + 'progress': {'readonly': True}, + 'error': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'policy': {'key': 'properties.policy', 'type': 'RollingUpgradePolicy'}, + 'running_status': {'key': 'properties.runningStatus', 'type': 'RollingUpgradeRunningStatus'}, + 'progress': {'key': 'properties.progress', 'type': 'RollingUpgradeProgressInfo'}, + 'error': {'key': 'properties.error', 'type': 'ApiError'}, + } + + def __init__( + self, + **kwargs + ): + super(RollingUpgradeStatusInfo, self).__init__(**kwargs) + self.policy = None + self.running_status = None + self.progress = None + self.error = None + + +class RunCommandDocumentBase(msrest.serialization.Model): + """Describes the properties of a Run Command metadata. + + All required parameters must be populated in order to send to Azure. + + :param schema: Required. The VM run command schema. + :type schema: str + :param id: Required. The VM run command id. + :type id: str + :param os_type: Required. The Operating System type. Possible values include: "Windows", + "Linux". + :type os_type: str or ~azure.mgmt.compute.v2021_03_01.models.OperatingSystemTypes + :param label: Required. The VM run command label. + :type label: str + :param description: Required. The VM run command description. + :type description: str + """ + + _validation = { + 'schema': {'required': True}, + 'id': {'required': True}, + 'os_type': {'required': True}, + 'label': {'required': True}, + 'description': {'required': True}, + } + + _attribute_map = { + 'schema': {'key': '$schema', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'os_type': {'key': 'osType', 'type': 'str'}, + 'label': {'key': 'label', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RunCommandDocumentBase, self).__init__(**kwargs) + self.schema = kwargs['schema'] + self.id = kwargs['id'] + self.os_type = kwargs['os_type'] + self.label = kwargs['label'] + self.description = kwargs['description'] + + +class RunCommandDocument(RunCommandDocumentBase): + """Describes the properties of a Run Command. + + All required parameters must be populated in order to send to Azure. + + :param schema: Required. The VM run command schema. + :type schema: str + :param id: Required. The VM run command id. + :type id: str + :param os_type: Required. The Operating System type. Possible values include: "Windows", + "Linux". + :type os_type: str or ~azure.mgmt.compute.v2021_03_01.models.OperatingSystemTypes + :param label: Required. The VM run command label. + :type label: str + :param description: Required. The VM run command description. + :type description: str + :param script: Required. The script to be executed. + :type script: list[str] + :param parameters: The parameters used by the script. + :type parameters: list[~azure.mgmt.compute.v2021_03_01.models.RunCommandParameterDefinition] + """ + + _validation = { + 'schema': {'required': True}, + 'id': {'required': True}, + 'os_type': {'required': True}, + 'label': {'required': True}, + 'description': {'required': True}, + 'script': {'required': True}, + } + + _attribute_map = { + 'schema': {'key': '$schema', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'os_type': {'key': 'osType', 'type': 'str'}, + 'label': {'key': 'label', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'script': {'key': 'script', 'type': '[str]'}, + 'parameters': {'key': 'parameters', 'type': '[RunCommandParameterDefinition]'}, + } + + def __init__( + self, + **kwargs + ): + super(RunCommandDocument, self).__init__(**kwargs) + self.script = kwargs['script'] + self.parameters = kwargs.get('parameters', None) + + +class RunCommandInput(msrest.serialization.Model): + """Capture Virtual Machine parameters. + + All required parameters must be populated in order to send to Azure. + + :param command_id: Required. The run command id. + :type command_id: str + :param script: Optional. The script to be executed. When this value is given, the given script + will override the default script of the command. + :type script: list[str] + :param parameters: The run command parameters. + :type parameters: list[~azure.mgmt.compute.v2021_03_01.models.RunCommandInputParameter] + """ + + _validation = { + 'command_id': {'required': True}, + } + + _attribute_map = { + 'command_id': {'key': 'commandId', 'type': 'str'}, + 'script': {'key': 'script', 'type': '[str]'}, + 'parameters': {'key': 'parameters', 'type': '[RunCommandInputParameter]'}, + } + + def __init__( + self, + **kwargs + ): + super(RunCommandInput, self).__init__(**kwargs) + self.command_id = kwargs['command_id'] + self.script = kwargs.get('script', None) + self.parameters = kwargs.get('parameters', None) + + +class RunCommandInputParameter(msrest.serialization.Model): + """Describes the properties of a run command parameter. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The run command parameter name. + :type name: str + :param value: Required. The run command parameter value. + :type value: str + """ + + _validation = { + 'name': {'required': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RunCommandInputParameter, self).__init__(**kwargs) + self.name = kwargs['name'] + self.value = kwargs['value'] + + +class RunCommandListResult(msrest.serialization.Model): + """The List Virtual Machine operation response. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. The list of virtual machine run commands. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.RunCommandDocumentBase] + :param next_link: The uri to fetch the next page of run commands. Call ListNext() with this to + fetch the next page of run commands. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[RunCommandDocumentBase]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RunCommandListResult, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = kwargs.get('next_link', None) + + +class RunCommandParameterDefinition(msrest.serialization.Model): + """Describes the properties of a run command parameter. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The run command parameter name. + :type name: str + :param type: Required. The run command parameter type. + :type type: str + :param default_value: The run command parameter default value. + :type default_value: str + :param required: The run command parameter required. + :type required: bool + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'default_value': {'key': 'defaultValue', 'type': 'str'}, + 'required': {'key': 'required', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(RunCommandParameterDefinition, self).__init__(**kwargs) + self.name = kwargs['name'] + self.type = kwargs['type'] + self.default_value = kwargs.get('default_value', None) + self.required = kwargs.get('required', False) + + +class RunCommandResult(msrest.serialization.Model): + """RunCommandResult. + + :param value: Run command operation response. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[InstanceViewStatus]'}, + } + + def __init__( + self, + **kwargs + ): + super(RunCommandResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class ScaleInPolicy(msrest.serialization.Model): + """Describes a scale-in policy for a virtual machine scale set. + + :param rules: The rules to be followed when scaling-in a virtual machine scale set. + :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` **Default** When a + virtual machine scale set is scaled in, the scale set will first be balanced across zones if it + is a zonal scale set. Then, it will be balanced across Fault Domains as far as possible. Within + each Fault Domain, the virtual machines chosen for removal will be the newest ones that are not + protected from scale-in. :code:`
    `:code:`
    ` **OldestVM** When a virtual machine scale set + is being scaled-in, the oldest virtual machines that are not protected from scale-in will be + chosen for removal. For zonal virtual machine scale sets, the scale set will first be balanced + across zones. Within each zone, the oldest virtual machines that are not protected will be + chosen for removal. :code:`
    `:code:`
    ` **NewestVM** When a virtual machine scale set is + being scaled-in, the newest virtual machines that are not protected from scale-in will be + chosen for removal. For zonal virtual machine scale sets, the scale set will first be balanced + across zones. Within each zone, the newest virtual machines that are not protected will be + chosen for removal. :code:`
    `:code:`
    `. + :type rules: list[str or + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetScaleInRules] + """ + + _attribute_map = { + 'rules': {'key': 'rules', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(ScaleInPolicy, self).__init__(**kwargs) + self.rules = kwargs.get('rules', None) + + +class ScheduledEventsProfile(msrest.serialization.Model): + """ScheduledEventsProfile. + + :param terminate_notification_profile: Specifies Terminate Scheduled Event related + configurations. + :type terminate_notification_profile: + ~azure.mgmt.compute.v2021_03_01.models.TerminateNotificationProfile + """ + + _attribute_map = { + 'terminate_notification_profile': {'key': 'terminateNotificationProfile', 'type': 'TerminateNotificationProfile'}, + } + + def __init__( + self, + **kwargs + ): + super(ScheduledEventsProfile, self).__init__(**kwargs) + self.terminate_notification_profile = kwargs.get('terminate_notification_profile', None) + + +class SecurityProfile(msrest.serialization.Model): + """Specifies the Security profile settings for the virtual machine or virtual machine scale set. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param uefi_settings: Specifies the security settings like secure boot and vTPM used while + creating the virtual machine. :code:`
    `:code:`
    `Minimum api-version: 2020-12-01. + :type uefi_settings: ~azure.mgmt.compute.v2021_03_01.models.UefiSettings + :param encryption_at_host: This property can be used by user in the request to enable or + disable the Host Encryption for the virtual machine or virtual machine scale set. This will + enable the encryption for all the disks including Resource/Temp disk at host itself. + :code:`
    `:code:`
    ` Default: The Encryption at host will be disabled unless this property + is set to true for the resource. + :type encryption_at_host: bool + :ivar security_type: Specifies the SecurityType of the virtual machine. It is set as + TrustedLaunch to enable UefiSettings. :code:`
    `:code:`
    ` Default: UefiSettings will not + be enabled unless this property is set as TrustedLaunch. Default value: "TrustedLaunch". + :vartype security_type: str + """ + + _validation = { + 'security_type': {'constant': True}, + } + + _attribute_map = { + 'uefi_settings': {'key': 'uefiSettings', 'type': 'UefiSettings'}, + 'encryption_at_host': {'key': 'encryptionAtHost', 'type': 'bool'}, + 'security_type': {'key': 'securityType', 'type': 'str'}, + } + + security_type = "TrustedLaunch" + + def __init__( + self, + **kwargs + ): + super(SecurityProfile, self).__init__(**kwargs) + self.uefi_settings = kwargs.get('uefi_settings', None) + self.encryption_at_host = kwargs.get('encryption_at_host', None) + + +class Sku(msrest.serialization.Model): + """Describes a virtual machine scale set sku. NOTE: If the new VM SKU is not supported on the hardware the scale set is currently on, you need to deallocate the VMs in the scale set before you modify the SKU name. + + :param name: The sku name. + :type name: str + :param tier: Specifies the tier of virtual machines in a scale set.:code:`
    `:code:`
    ` + Possible Values::code:`
    `:code:`
    ` **Standard**\ :code:`
    `:code:`
    ` + **Basic**. + :type tier: str + :param capacity: Specifies the number of virtual machines in the scale set. + :type capacity: long + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(Sku, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.tier = kwargs.get('tier', None) + self.capacity = kwargs.get('capacity', None) + + +class SshConfiguration(msrest.serialization.Model): + """SSH configuration for Linux based VMs running on Azure. + + :param public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :type public_keys: list[~azure.mgmt.compute.v2021_03_01.models.SshPublicKey] + """ + + _attribute_map = { + 'public_keys': {'key': 'publicKeys', 'type': '[SshPublicKey]'}, + } + + def __init__( + self, + **kwargs + ): + super(SshConfiguration, self).__init__(**kwargs) + self.public_keys = kwargs.get('public_keys', None) + + +class SshPublicKey(msrest.serialization.Model): + """Contains information about SSH certificate public key and the path on the Linux VM where the public key is placed. + + :param path: Specifies the full path on the created VM where ssh public key is stored. If the + file already exists, the specified key is appended to the file. Example: + /home/user/.ssh/authorized_keys. + :type path: str + :param key_data: SSH public key certificate used to authenticate with the VM through ssh. The + key needs to be at least 2048-bit and in ssh-rsa format. :code:`
    `:code:`
    ` For creating + ssh keys, see `Create SSH keys on Linux and Mac for Linux VMs in Azure + `_. + :type key_data: str + """ + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'key_data': {'key': 'keyData', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SshPublicKey, self).__init__(**kwargs) + self.path = kwargs.get('path', None) + self.key_data = kwargs.get('key_data', None) + + +class SshPublicKeyGenerateKeyPairResult(msrest.serialization.Model): + """Response from generation of an SSH key pair. + + All required parameters must be populated in order to send to Azure. + + :param private_key: Required. Private key portion of the key pair used to authenticate to a + virtual machine through ssh. The private key is returned in RFC3447 format and should be + treated as a secret. + :type private_key: str + :param public_key: Required. Public key portion of the key pair used to authenticate to a + virtual machine through ssh. The public key is in ssh-rsa format. + :type public_key: str + :param id: Required. The ARM resource id in the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. + :type id: str + """ + + _validation = { + 'private_key': {'required': True}, + 'public_key': {'required': True}, + 'id': {'required': True}, + } + + _attribute_map = { + 'private_key': {'key': 'privateKey', 'type': 'str'}, + 'public_key': {'key': 'publicKey', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SshPublicKeyGenerateKeyPairResult, self).__init__(**kwargs) + self.private_key = kwargs['private_key'] + self.public_key = kwargs['public_key'] + self.id = kwargs['id'] + + +class SshPublicKeyResource(Resource): + """Specifies information about the SSH public key. + + 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 id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param public_key: SSH public key used to authenticate to a virtual machine through ssh. If + this property is not initially provided when the resource is created, the publicKey property + will be populated when generateKeyPair is called. If the public key is provided upon resource + creation, the provided public key needs to be at least 2048-bit and in ssh-rsa format. + :type public_key: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'public_key': {'key': 'properties.publicKey', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SshPublicKeyResource, self).__init__(**kwargs) + self.public_key = kwargs.get('public_key', None) + + +class SshPublicKeysGroupListResult(msrest.serialization.Model): + """The list SSH public keys operation response. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. The list of SSH public keys. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.SshPublicKeyResource] + :param next_link: The URI to fetch the next page of SSH public keys. Call ListNext() with this + URI to fetch the next page of SSH public keys. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SshPublicKeyResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SshPublicKeysGroupListResult, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = kwargs.get('next_link', None) + + +class SshPublicKeyUpdateResource(UpdateResource): + """Specifies information about the SSH public key. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param public_key: SSH public key used to authenticate to a virtual machine through ssh. If + this property is not initially provided when the resource is created, the publicKey property + will be populated when generateKeyPair is called. If the public key is provided upon resource + creation, the provided public key needs to be at least 2048-bit and in ssh-rsa format. + :type public_key: str + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'public_key': {'key': 'properties.publicKey', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SshPublicKeyUpdateResource, self).__init__(**kwargs) + self.public_key = kwargs.get('public_key', None) + + +class StatusCodeCount(msrest.serialization.Model): + """StatusCodeCount. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The instance view status code. + :vartype code: str + :ivar count: Number of instances having this status code. + :vartype count: int + """ + + _validation = { + 'code': {'readonly': True}, + 'count': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(StatusCodeCount, self).__init__(**kwargs) + self.code = None + self.count = None + + +class StorageProfile(msrest.serialization.Model): + """Specifies the storage settings for the virtual machine disks. + + :param image_reference: Specifies information about the image to use. You can specify + information about platform images, marketplace images, or virtual machine images. This element + is required when you want to use a platform image, marketplace image, or virtual machine image, + but is not used in other creation operations. + :type image_reference: ~azure.mgmt.compute.v2021_03_01.models.ImageReference + :param os_disk: Specifies information about the operating system disk used by the virtual + machine. :code:`
    `:code:`
    ` For more information about disks, see `About disks and VHDs + for Azure virtual machines `_. + :type os_disk: ~azure.mgmt.compute.v2021_03_01.models.OSDisk + :param data_disks: Specifies the parameters that are used to add a data disk to a virtual + machine. :code:`
    `:code:`
    ` For more information about disks, see `About disks and VHDs + for Azure virtual machines `_. + :type data_disks: list[~azure.mgmt.compute.v2021_03_01.models.DataDisk] + """ + + _attribute_map = { + 'image_reference': {'key': 'imageReference', 'type': 'ImageReference'}, + 'os_disk': {'key': 'osDisk', 'type': 'OSDisk'}, + 'data_disks': {'key': 'dataDisks', 'type': '[DataDisk]'}, + } + + def __init__( + self, + **kwargs + ): + super(StorageProfile, self).__init__(**kwargs) + self.image_reference = kwargs.get('image_reference', None) + self.os_disk = kwargs.get('os_disk', None) + self.data_disks = kwargs.get('data_disks', None) + + +class SubResourceReadOnly(msrest.serialization.Model): + """SubResourceReadOnly. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SubResourceReadOnly, self).__init__(**kwargs) + self.id = None + + +class SubResourceWithColocationStatus(SubResource): + """SubResourceWithColocationStatus. + + :param id: Resource Id. + :type id: str + :param colocation_status: Describes colocation status of a resource in the Proximity Placement + Group. + :type colocation_status: ~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'colocation_status': {'key': 'colocationStatus', 'type': 'InstanceViewStatus'}, + } + + def __init__( + self, + **kwargs + ): + super(SubResourceWithColocationStatus, self).__init__(**kwargs) + self.colocation_status = kwargs.get('colocation_status', None) + + +class TerminateNotificationProfile(msrest.serialization.Model): + """TerminateNotificationProfile. + + :param not_before_timeout: Configurable length of time a Virtual Machine being deleted will + have to potentially approve the Terminate Scheduled Event before the event is auto approved + (timed out). The configuration must be specified in ISO 8601 format, the default value is 5 + minutes (PT5M). + :type not_before_timeout: str + :param enable: Specifies whether the Terminate Scheduled event is enabled or disabled. + :type enable: bool + """ + + _attribute_map = { + 'not_before_timeout': {'key': 'notBeforeTimeout', 'type': 'str'}, + 'enable': {'key': 'enable', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(TerminateNotificationProfile, self).__init__(**kwargs) + self.not_before_timeout = kwargs.get('not_before_timeout', None) + self.enable = kwargs.get('enable', None) + + +class ThrottledRequestsInput(LogAnalyticsInputBase): + """Api request input for LogAnalytics getThrottledRequests Api. + + All required parameters must be populated in order to send to Azure. + + :param blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :type blob_container_sas_uri: str + :param from_time: Required. From time of the query. + :type from_time: ~datetime.datetime + :param to_time: Required. To time of the query. + :type to_time: ~datetime.datetime + :param group_by_throttle_policy: Group query result by Throttle Policy applied. + :type group_by_throttle_policy: bool + :param group_by_operation_name: Group query result by Operation Name. + :type group_by_operation_name: bool + :param group_by_resource_name: Group query result by Resource Name. + :type group_by_resource_name: bool + :param group_by_client_application_id: Group query result by Client Application ID. + :type group_by_client_application_id: bool + :param group_by_user_agent: Group query result by User Agent. + :type group_by_user_agent: bool + """ + + _validation = { + 'blob_container_sas_uri': {'required': True}, + 'from_time': {'required': True}, + 'to_time': {'required': True}, + } + + _attribute_map = { + 'blob_container_sas_uri': {'key': 'blobContainerSasUri', 'type': 'str'}, + 'from_time': {'key': 'fromTime', 'type': 'iso-8601'}, + 'to_time': {'key': 'toTime', 'type': 'iso-8601'}, + 'group_by_throttle_policy': {'key': 'groupByThrottlePolicy', 'type': 'bool'}, + 'group_by_operation_name': {'key': 'groupByOperationName', 'type': 'bool'}, + 'group_by_resource_name': {'key': 'groupByResourceName', 'type': 'bool'}, + 'group_by_client_application_id': {'key': 'groupByClientApplicationId', 'type': 'bool'}, + 'group_by_user_agent': {'key': 'groupByUserAgent', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(ThrottledRequestsInput, self).__init__(**kwargs) + + +class UefiSettings(msrest.serialization.Model): + """Specifies the security settings like secure boot and vTPM used while creating the virtual machine. :code:`
    `:code:`
    `Minimum api-version: 2020-12-01. + + :param secure_boot_enabled: Specifies whether secure boot should be enabled on the virtual + machine. :code:`
    `:code:`
    `Minimum api-version: 2020-12-01. + :type secure_boot_enabled: bool + :param v_tpm_enabled: Specifies whether vTPM should be enabled on the virtual machine. + :code:`
    `:code:`
    `Minimum api-version: 2020-12-01. + :type v_tpm_enabled: bool + """ + + _attribute_map = { + 'secure_boot_enabled': {'key': 'secureBootEnabled', 'type': 'bool'}, + 'v_tpm_enabled': {'key': 'vTpmEnabled', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(UefiSettings, self).__init__(**kwargs) + self.secure_boot_enabled = kwargs.get('secure_boot_enabled', None) + self.v_tpm_enabled = kwargs.get('v_tpm_enabled', None) + + +class UpdateDomain(msrest.serialization.Model): + """Defines an update domain for the cloud service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource Name. + :vartype name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(UpdateDomain, self).__init__(**kwargs) + self.id = None + self.name = None + + +class UpdateDomainListResult(msrest.serialization.Model): + """UpdateDomainListResult. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.UpdateDomain] + :param next_link: + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[UpdateDomain]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(UpdateDomainListResult, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = kwargs.get('next_link', None) + + +class UpgradeOperationHistoricalStatusInfo(msrest.serialization.Model): + """Virtual Machine Scale Set OS Upgrade History operation response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar properties: Information about the properties of the upgrade operation. + :vartype properties: + ~azure.mgmt.compute.v2021_03_01.models.UpgradeOperationHistoricalStatusInfoProperties + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + """ + + _validation = { + 'properties': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'UpgradeOperationHistoricalStatusInfoProperties'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(UpgradeOperationHistoricalStatusInfo, self).__init__(**kwargs) + self.properties = None + self.type = None + self.location = None + + +class UpgradeOperationHistoricalStatusInfoProperties(msrest.serialization.Model): + """Describes each OS upgrade on the Virtual Machine Scale Set. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar running_status: Information about the overall status of the upgrade operation. + :vartype running_status: ~azure.mgmt.compute.v2021_03_01.models.UpgradeOperationHistoryStatus + :ivar progress: Counts of the VMs in each state. + :vartype progress: ~azure.mgmt.compute.v2021_03_01.models.RollingUpgradeProgressInfo + :ivar error: Error Details for this upgrade if there are any. + :vartype error: ~azure.mgmt.compute.v2021_03_01.models.ApiError + :ivar started_by: Invoker of the Upgrade Operation. Possible values include: "Unknown", "User", + "Platform". + :vartype started_by: str or ~azure.mgmt.compute.v2021_03_01.models.UpgradeOperationInvoker + :ivar target_image_reference: Image Reference details. + :vartype target_image_reference: ~azure.mgmt.compute.v2021_03_01.models.ImageReference + :ivar rollback_info: Information about OS rollback if performed. + :vartype rollback_info: ~azure.mgmt.compute.v2021_03_01.models.RollbackStatusInfo + """ + + _validation = { + 'running_status': {'readonly': True}, + 'progress': {'readonly': True}, + 'error': {'readonly': True}, + 'started_by': {'readonly': True}, + 'target_image_reference': {'readonly': True}, + 'rollback_info': {'readonly': True}, + } + + _attribute_map = { + 'running_status': {'key': 'runningStatus', 'type': 'UpgradeOperationHistoryStatus'}, + 'progress': {'key': 'progress', 'type': 'RollingUpgradeProgressInfo'}, + 'error': {'key': 'error', 'type': 'ApiError'}, + 'started_by': {'key': 'startedBy', 'type': 'str'}, + 'target_image_reference': {'key': 'targetImageReference', 'type': 'ImageReference'}, + 'rollback_info': {'key': 'rollbackInfo', 'type': 'RollbackStatusInfo'}, + } + + def __init__( + self, + **kwargs + ): + super(UpgradeOperationHistoricalStatusInfoProperties, self).__init__(**kwargs) + self.running_status = None + self.progress = None + self.error = None + self.started_by = None + self.target_image_reference = None + self.rollback_info = None + + +class UpgradeOperationHistoryStatus(msrest.serialization.Model): + """Information about the current running state of the overall upgrade. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Code indicating the current status of the upgrade. Possible values include: + "RollingForward", "Cancelled", "Completed", "Faulted". + :vartype code: str or ~azure.mgmt.compute.v2021_03_01.models.UpgradeState + :ivar start_time: Start time of the upgrade. + :vartype start_time: ~datetime.datetime + :ivar end_time: End time of the upgrade. + :vartype end_time: ~datetime.datetime + """ + + _validation = { + 'code': {'readonly': True}, + 'start_time': {'readonly': True}, + 'end_time': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(UpgradeOperationHistoryStatus, self).__init__(**kwargs) + self.code = None + self.start_time = None + self.end_time = None + + +class UpgradePolicy(msrest.serialization.Model): + """Describes an upgrade policy - automatic, manual, or rolling. + + :param mode: Specifies the mode of an upgrade to virtual machines in the scale set.:code:`
    `:code:`
    ` Possible values are::code:`
    `:code:`
    ` **Manual** - You control + the application of updates to virtual machines in the scale set. You do this by using the + manualUpgrade action.:code:`
    `:code:`
    ` **Automatic** - All virtual machines in the + scale set are automatically updated at the same time. Possible values include: "Automatic", + "Manual", "Rolling". + :type mode: str or ~azure.mgmt.compute.v2021_03_01.models.UpgradeMode + :param rolling_upgrade_policy: The configuration parameters used while performing a rolling + upgrade. + :type rolling_upgrade_policy: ~azure.mgmt.compute.v2021_03_01.models.RollingUpgradePolicy + :param automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS + Upgrade. + :type automatic_os_upgrade_policy: + ~azure.mgmt.compute.v2021_03_01.models.AutomaticOSUpgradePolicy + """ + + _attribute_map = { + 'mode': {'key': 'mode', 'type': 'str'}, + 'rolling_upgrade_policy': {'key': 'rollingUpgradePolicy', 'type': 'RollingUpgradePolicy'}, + 'automatic_os_upgrade_policy': {'key': 'automaticOSUpgradePolicy', 'type': 'AutomaticOSUpgradePolicy'}, + } + + def __init__( + self, + **kwargs + ): + super(UpgradePolicy, self).__init__(**kwargs) + self.mode = kwargs.get('mode', None) + self.rolling_upgrade_policy = kwargs.get('rolling_upgrade_policy', None) + self.automatic_os_upgrade_policy = kwargs.get('automatic_os_upgrade_policy', None) + + +class Usage(msrest.serialization.Model): + """Describes Compute Resource Usage. + + 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 unit: Required. An enum describing the unit of usage measurement. Default value: "Count". + :vartype unit: str + :param current_value: Required. The current usage of the resource. + :type current_value: int + :param limit: Required. The maximum permitted usage of the resource. + :type limit: long + :param name: Required. The name of the type of usage. + :type name: ~azure.mgmt.compute.v2021_03_01.models.UsageName + """ + + _validation = { + 'unit': {'required': True, 'constant': True}, + 'current_value': {'required': True}, + 'limit': {'required': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'unit': {'key': 'unit', 'type': 'str'}, + 'current_value': {'key': 'currentValue', 'type': 'int'}, + 'limit': {'key': 'limit', 'type': 'long'}, + 'name': {'key': 'name', 'type': 'UsageName'}, + } + + unit = "Count" + + def __init__( + self, + **kwargs + ): + super(Usage, self).__init__(**kwargs) + self.current_value = kwargs['current_value'] + self.limit = kwargs['limit'] + self.name = kwargs['name'] + + +class UsageName(msrest.serialization.Model): + """The Usage Names. + + :param value: The name of the resource. + :type value: str + :param localized_value: The localized name of the resource. + :type localized_value: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(UsageName, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.localized_value = kwargs.get('localized_value', None) + + +class UserAssignedIdentitiesValue(msrest.serialization.Model): + """UserAssignedIdentitiesValue. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(UserAssignedIdentitiesValue, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class VaultCertificate(msrest.serialization.Model): + """Describes a single certificate reference in a Key Vault, and where the certificate should reside on the VM. + + :param certificate_url: This is the URL of a certificate that has been uploaded to Key Vault as + a secret. For adding a secret to the Key Vault, see `Add a key or secret to the key vault + `_. In this case, your + certificate needs to be It is the Base64 encoding of the following JSON Object which is encoded + in UTF-8: :code:`
    `:code:`
    ` {:code:`
    ` "data":":code:``",:code:`
    ` "dataType":"pfx",:code:`
    ` "password":":code:``":code:`
    `}. + :type certificate_url: str + :param certificate_store: For Windows VMs, specifies the certificate store on the Virtual + Machine to which the certificate should be added. The specified certificate store is implicitly + in the LocalMachine account. :code:`
    `:code:`
    `For Linux VMs, the certificate file is + placed under the /var/lib/waagent directory, with the file name <UppercaseThumbprint>.crt + for the X509 certificate file and <UppercaseThumbprint>.prv for private key. Both of + these files are .pem formatted. + :type certificate_store: str + """ + + _attribute_map = { + 'certificate_url': {'key': 'certificateUrl', 'type': 'str'}, + 'certificate_store': {'key': 'certificateStore', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VaultCertificate, self).__init__(**kwargs) + self.certificate_url = kwargs.get('certificate_url', None) + self.certificate_store = kwargs.get('certificate_store', None) + + +class VaultSecretGroup(msrest.serialization.Model): + """Describes a set of certificates which are all in the same Key Vault. + + :param source_vault: The relative URL of the Key Vault containing all of the certificates in + VaultCertificates. + :type source_vault: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param vault_certificates: The list of key vault references in SourceVault which contain + certificates. + :type vault_certificates: list[~azure.mgmt.compute.v2021_03_01.models.VaultCertificate] + """ + + _attribute_map = { + 'source_vault': {'key': 'sourceVault', 'type': 'SubResource'}, + 'vault_certificates': {'key': 'vaultCertificates', 'type': '[VaultCertificate]'}, + } + + def __init__( + self, + **kwargs + ): + super(VaultSecretGroup, self).__init__(**kwargs) + self.source_vault = kwargs.get('source_vault', None) + self.vault_certificates = kwargs.get('vault_certificates', None) + + +class VirtualHardDisk(msrest.serialization.Model): + """Describes the uri of a disk. + + :param uri: Specifies the virtual hard disk's uri. + :type uri: str + """ + + _attribute_map = { + 'uri': {'key': 'uri', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualHardDisk, self).__init__(**kwargs) + self.uri = kwargs.get('uri', None) + + +class VirtualMachine(Resource): + """Describes a 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 id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param plan: Specifies information about the marketplace image used to create the virtual + machine. This element is only used for marketplace images. Before you can use a marketplace + image from an API, you must enable the image for programmatic use. In the Azure portal, find + the marketplace image that you want to use and then click **Want to deploy programmatically, + Get Started ->**. Enter any required information and then click **Save**. + :type plan: ~azure.mgmt.compute.v2021_03_01.models.Plan + :ivar resources: The virtual machine child extension resources. + :vartype resources: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtension] + :param identity: The identity of the virtual machine, if configured. + :type identity: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineIdentity + :param zones: The virtual machine zones. + :type zones: list[str] + :param extended_location: The extended location of the Virtual Machine. + :type extended_location: ~azure.mgmt.compute.v2021_03_01.models.ExtendedLocation + :param hardware_profile: Specifies the hardware settings for the virtual machine. + :type hardware_profile: ~azure.mgmt.compute.v2021_03_01.models.HardwareProfile + :param storage_profile: Specifies the storage settings for the virtual machine disks. + :type storage_profile: ~azure.mgmt.compute.v2021_03_01.models.StorageProfile + :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + virtual machine. + :type additional_capabilities: ~azure.mgmt.compute.v2021_03_01.models.AdditionalCapabilities + :param os_profile: Specifies the operating system settings used while creating the virtual + machine. Some of the settings cannot be changed once VM is provisioned. + :type os_profile: ~azure.mgmt.compute.v2021_03_01.models.OSProfile + :param network_profile: Specifies the network interfaces of the virtual machine. + :type network_profile: ~azure.mgmt.compute.v2021_03_01.models.NetworkProfile + :param security_profile: Specifies the Security related profile settings for the virtual + machine. + :type security_profile: ~azure.mgmt.compute.v2021_03_01.models.SecurityProfile + :param diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :type diagnostics_profile: ~azure.mgmt.compute.v2021_03_01.models.DiagnosticsProfile + :param availability_set: Specifies information about the availability set that the virtual + machine should be assigned to. Virtual machines specified in the same availability set are + allocated to different nodes to maximize availability. For more information about availability + sets, see `Manage the availability of virtual machines + `_. :code:`
    `:code:`
    ` + For more information on Azure planned maintenance, see `Planned maintenance for virtual + machines in Azure `_ + :code:`
    `:code:`
    ` Currently, a VM can only be added to availability set at creation + time. The availability set to which the VM is being added should be under the same resource + group as the availability set resource. An existing VM cannot be added to an availability set. + :code:`
    `:code:`
    `This property cannot exist along with a non-null + properties.virtualMachineScaleSet reference. + :type availability_set: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param virtual_machine_scale_set: Specifies information about the virtual machine scale set + that the virtual machine should be assigned to. Virtual machines specified in the same virtual + machine scale set are allocated to different nodes to maximize availability. Currently, a VM + can only be added to virtual machine scale set at creation time. An existing VM cannot be added + to a virtual machine scale set. :code:`
    `:code:`
    `This property cannot exist along with a + non-null properties.availabilitySet reference. :code:`
    `:code:`
    `Minimum api‐version: + 2019‐03‐01. + :type virtual_machine_scale_set: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param proximity_placement_group: Specifies information about the proximity placement group + that the virtual machine should be assigned to. :code:`
    `:code:`
    `Minimum api-version: + 2018-04-01. + :type proximity_placement_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param priority: Specifies the priority for the virtual machine. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. Possible values include: "Regular", + "Low", "Spot". + :type priority: str or ~azure.mgmt.compute.v2021_03_01.models.VirtualMachinePriorityTypes + :param eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and + Azure Spot scale set. :code:`
    `:code:`
    `For Azure Spot virtual machines, both + 'Deallocate' and 'Delete' are supported and the minimum api-version is 2019-03-01. + :code:`
    `:code:`
    `For Azure Spot scale sets, both 'Deallocate' and 'Delete' are supported + and the minimum api-version is 2017-10-30-preview. Possible values include: "Deallocate", + "Delete". + :type eviction_policy: str or + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineEvictionPolicyTypes + :param billing_profile: Specifies the billing related details of a Azure Spot virtual machine. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :type billing_profile: ~azure.mgmt.compute.v2021_03_01.models.BillingProfile + :param host: Specifies information about the dedicated host that the virtual machine resides + in. :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :type host: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param host_group: Specifies information about the dedicated host group that the virtual + machine resides in. :code:`
    `:code:`
    `Minimum api-version: 2020-06-01. + :code:`
    `:code:`
    `NOTE: User cannot specify both host and hostGroup properties. + :type host_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :ivar instance_view: The virtual machine instance view. + :vartype instance_view: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineInstanceView + :param license_type: Specifies that the image or disk that is being used was licensed on- + premises. :code:`
    `:code:`
    ` Possible values for Windows Server operating system are: + :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server + :code:`
    `:code:`
    ` Possible values for Linux Server operating system are: + :code:`
    `:code:`
    ` RHEL_BYOS (for RHEL) :code:`
    `:code:`
    ` SLES_BYOS (for SUSE) + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` `Azure Hybrid Use Benefit for Linux Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :type license_type: str + :ivar vm_id: Specifies the VM unique ID which is a 128-bits identifier that is encoded and + stored in all Azure IaaS VMs SMBIOS and can be read using platform BIOS commands. + :vartype vm_id: str + :param extensions_time_budget: Specifies the time alloted for all extensions to start. The time + duration should be between 15 minutes and 120 minutes (inclusive) and should be specified in + ISO 8601 format. The default value is 90 minutes (PT1H30M). :code:`
    `:code:`
    ` Minimum + api-version: 2020-06-01. + :type extensions_time_budget: str + :param platform_fault_domain: Specifies the scale set logical fault domain into which the + Virtual Machine will be created. By default, the Virtual Machine will by automatically assigned + to a fault domain that best maintains balance across available fault + domains.:code:`
    `:code:`
  • `This is applicable only if the 'virtualMachineScaleSet' + property of this Virtual Machine is set.:code:`
  • `The Virtual Machine Scale Set that is + referenced, must have 'platformFaultDomainCount' > 1.:code:`
  • `This property cannot be + updated once the Virtual Machine is created.:code:`
  • `Fault domain assignment can be viewed + in the Virtual Machine Instance View.:code:`
    `:code:`
    `Minimum api‐version: 2020‐12‐01. + :type platform_fault_domain: int + :param user_data: UserData for the VM, which must be base-64 encoded. Customer should not pass + any secrets in here. :code:`
    `:code:`
    `Minimum api-version: 2021-03-01. + :type user_data: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'resources': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'instance_view': {'readonly': True}, + 'vm_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'plan': {'key': 'plan', 'type': 'Plan'}, + 'resources': {'key': 'resources', 'type': '[VirtualMachineExtension]'}, + 'identity': {'key': 'identity', 'type': 'VirtualMachineIdentity'}, + 'zones': {'key': 'zones', 'type': '[str]'}, + 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, + 'hardware_profile': {'key': 'properties.hardwareProfile', 'type': 'HardwareProfile'}, + 'storage_profile': {'key': 'properties.storageProfile', 'type': 'StorageProfile'}, + 'additional_capabilities': {'key': 'properties.additionalCapabilities', 'type': 'AdditionalCapabilities'}, + 'os_profile': {'key': 'properties.osProfile', 'type': 'OSProfile'}, + 'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'}, + 'security_profile': {'key': 'properties.securityProfile', 'type': 'SecurityProfile'}, + 'diagnostics_profile': {'key': 'properties.diagnosticsProfile', 'type': 'DiagnosticsProfile'}, + 'availability_set': {'key': 'properties.availabilitySet', 'type': 'SubResource'}, + 'virtual_machine_scale_set': {'key': 'properties.virtualMachineScaleSet', 'type': 'SubResource'}, + 'proximity_placement_group': {'key': 'properties.proximityPlacementGroup', 'type': 'SubResource'}, + 'priority': {'key': 'properties.priority', 'type': 'str'}, + 'eviction_policy': {'key': 'properties.evictionPolicy', 'type': 'str'}, + 'billing_profile': {'key': 'properties.billingProfile', 'type': 'BillingProfile'}, + 'host': {'key': 'properties.host', 'type': 'SubResource'}, + 'host_group': {'key': 'properties.hostGroup', 'type': 'SubResource'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'instance_view': {'key': 'properties.instanceView', 'type': 'VirtualMachineInstanceView'}, + 'license_type': {'key': 'properties.licenseType', 'type': 'str'}, + 'vm_id': {'key': 'properties.vmId', 'type': 'str'}, + 'extensions_time_budget': {'key': 'properties.extensionsTimeBudget', 'type': 'str'}, + 'platform_fault_domain': {'key': 'properties.platformFaultDomain', 'type': 'int'}, + 'user_data': {'key': 'properties.userData', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachine, self).__init__(**kwargs) + self.plan = kwargs.get('plan', None) + self.resources = None + self.identity = kwargs.get('identity', None) + self.zones = kwargs.get('zones', None) + self.extended_location = kwargs.get('extended_location', None) + self.hardware_profile = kwargs.get('hardware_profile', None) + self.storage_profile = kwargs.get('storage_profile', None) + self.additional_capabilities = kwargs.get('additional_capabilities', None) + self.os_profile = kwargs.get('os_profile', None) + self.network_profile = kwargs.get('network_profile', None) + self.security_profile = kwargs.get('security_profile', None) + self.diagnostics_profile = kwargs.get('diagnostics_profile', None) + self.availability_set = kwargs.get('availability_set', None) + self.virtual_machine_scale_set = kwargs.get('virtual_machine_scale_set', None) + self.proximity_placement_group = kwargs.get('proximity_placement_group', None) + self.priority = kwargs.get('priority', None) + self.eviction_policy = kwargs.get('eviction_policy', None) + self.billing_profile = kwargs.get('billing_profile', None) + self.host = kwargs.get('host', None) + self.host_group = kwargs.get('host_group', None) + self.provisioning_state = None + self.instance_view = None + self.license_type = kwargs.get('license_type', None) + self.vm_id = None + self.extensions_time_budget = kwargs.get('extensions_time_budget', None) + self.platform_fault_domain = kwargs.get('platform_fault_domain', None) + self.user_data = kwargs.get('user_data', None) + + +class VirtualMachineAgentInstanceView(msrest.serialization.Model): + """The instance view of the VM Agent running on the virtual machine. + + :param vm_agent_version: The VM Agent full version. + :type vm_agent_version: str + :param extension_handlers: The virtual machine extension handler instance view. + :type extension_handlers: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtensionHandlerInstanceView] + :param statuses: The resource status information. + :type statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + """ + + _attribute_map = { + 'vm_agent_version': {'key': 'vmAgentVersion', 'type': 'str'}, + 'extension_handlers': {'key': 'extensionHandlers', 'type': '[VirtualMachineExtensionHandlerInstanceView]'}, + 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineAgentInstanceView, self).__init__(**kwargs) + self.vm_agent_version = kwargs.get('vm_agent_version', None) + self.extension_handlers = kwargs.get('extension_handlers', None) + self.statuses = kwargs.get('statuses', None) + + +class VirtualMachineAssessPatchesResult(msrest.serialization.Model): + """Describes the properties of an AssessPatches result. + + 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 "Unknown", "Failed", "Succeeded", + or "CompletedWithWarnings.". Possible values include: "Unknown", "InProgress", "Failed", + "Succeeded", "CompletedWithWarnings". + :vartype status: str or ~azure.mgmt.compute.v2021_03_01.models.PatchOperationStatus + :ivar assessment_activity_id: The activity ID of the operation that produced this result. It is + used to correlate across CRP and extension logs. + :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 critical_and_security_patch_count: The number of critical or security patches that have + been detected as available and not yet installed. + :vartype critical_and_security_patch_count: int + :ivar other_patch_count: The number of all available patches excluding critical and security. + :vartype other_patch_count: int + :ivar start_date_time: The UTC timestamp when the operation began. + :vartype start_date_time: ~datetime.datetime + :ivar available_patches: The list of patches that have been detected as available for + installation. + :vartype available_patches: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineSoftwarePatchProperties] + :ivar error: The errors that were encountered during execution of the operation. The details + array contains the list of them. + :vartype error: ~azure.mgmt.compute.v2021_03_01.models.ApiError + """ + + _validation = { + 'status': {'readonly': True}, + 'assessment_activity_id': {'readonly': True}, + 'reboot_pending': {'readonly': True}, + 'critical_and_security_patch_count': {'readonly': True}, + 'other_patch_count': {'readonly': True}, + 'start_date_time': {'readonly': True}, + 'available_patches': {'readonly': True}, + 'error': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'assessment_activity_id': {'key': 'assessmentActivityId', 'type': 'str'}, + 'reboot_pending': {'key': 'rebootPending', 'type': 'bool'}, + 'critical_and_security_patch_count': {'key': 'criticalAndSecurityPatchCount', 'type': 'int'}, + 'other_patch_count': {'key': 'otherPatchCount', 'type': 'int'}, + 'start_date_time': {'key': 'startDateTime', 'type': 'iso-8601'}, + 'available_patches': {'key': 'availablePatches', 'type': '[VirtualMachineSoftwarePatchProperties]'}, + 'error': {'key': 'error', 'type': 'ApiError'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineAssessPatchesResult, self).__init__(**kwargs) + self.status = None + self.assessment_activity_id = None + self.reboot_pending = None + self.critical_and_security_patch_count = None + self.other_patch_count = None + self.start_date_time = None + self.available_patches = None + self.error = None + + +class VirtualMachineCaptureParameters(msrest.serialization.Model): + """Capture Virtual Machine parameters. + + All required parameters must be populated in order to send to Azure. + + :param vhd_prefix: Required. The captured virtual hard disk's name prefix. + :type vhd_prefix: str + :param destination_container_name: Required. The destination container name. + :type destination_container_name: str + :param overwrite_vhds: Required. Specifies whether to overwrite the destination virtual hard + disk, in case of conflict. + :type overwrite_vhds: bool + """ + + _validation = { + 'vhd_prefix': {'required': True}, + 'destination_container_name': {'required': True}, + 'overwrite_vhds': {'required': True}, + } + + _attribute_map = { + 'vhd_prefix': {'key': 'vhdPrefix', 'type': 'str'}, + 'destination_container_name': {'key': 'destinationContainerName', 'type': 'str'}, + 'overwrite_vhds': {'key': 'overwriteVhds', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineCaptureParameters, self).__init__(**kwargs) + self.vhd_prefix = kwargs['vhd_prefix'] + self.destination_container_name = kwargs['destination_container_name'] + self.overwrite_vhds = kwargs['overwrite_vhds'] + + +class VirtualMachineCaptureResult(SubResource): + """Output of virtual machine capture operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param id: Resource Id. + :type id: str + :ivar schema: the schema of the captured virtual machine. + :vartype schema: str + :ivar content_version: the version of the content. + :vartype content_version: str + :ivar parameters: parameters of the captured virtual machine. + :vartype parameters: object + :ivar resources: a list of resource items of the captured virtual machine. + :vartype resources: list[object] + """ + + _validation = { + 'schema': {'readonly': True}, + 'content_version': {'readonly': True}, + 'parameters': {'readonly': True}, + 'resources': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'schema': {'key': '$schema', 'type': 'str'}, + 'content_version': {'key': 'contentVersion', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': 'object'}, + 'resources': {'key': 'resources', 'type': '[object]'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineCaptureResult, self).__init__(**kwargs) + self.schema = None + self.content_version = None + self.parameters = None + self.resources = None + + +class VirtualMachineExtension(Resource): + """Describes a Virtual Machine Extension. + + 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 id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :type force_update_tag: str + :param publisher: The name of the extension handler publisher. + :type publisher: str + :param type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :type type_properties_type: str + :param type_handler_version: Specifies the version of the script handler. + :type type_handler_version: str + :param 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. + :type auto_upgrade_minor_version: bool + :param enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :type enable_automatic_upgrade: bool + :param settings: Json formatted public settings for the extension. + :type settings: object + :param protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :type protected_settings: object + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :param instance_view: The virtual machine extension instance view. + :type instance_view: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtensionInstanceView + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', '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'}, + 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, + 'enable_automatic_upgrade': {'key': 'properties.enableAutomaticUpgrade', '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': 'VirtualMachineExtensionInstanceView'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineExtension, self).__init__(**kwargs) + self.force_update_tag = kwargs.get('force_update_tag', None) + self.publisher = kwargs.get('publisher', None) + self.type_properties_type = kwargs.get('type_properties_type', None) + self.type_handler_version = kwargs.get('type_handler_version', None) + self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', None) + self.enable_automatic_upgrade = kwargs.get('enable_automatic_upgrade', None) + self.settings = kwargs.get('settings', None) + self.protected_settings = kwargs.get('protected_settings', None) + self.provisioning_state = None + self.instance_view = kwargs.get('instance_view', None) + + +class VirtualMachineExtensionHandlerInstanceView(msrest.serialization.Model): + """The instance view of a virtual machine extension handler. + + :param type: Specifies the type of the extension; an example is "CustomScriptExtension". + :type type: str + :param type_handler_version: Specifies the version of the script handler. + :type type_handler_version: str + :param status: The extension handler status. + :type status: ~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'type_handler_version': {'key': 'typeHandlerVersion', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'InstanceViewStatus'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineExtensionHandlerInstanceView, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.type_handler_version = kwargs.get('type_handler_version', None) + self.status = kwargs.get('status', None) + + +class VirtualMachineExtensionImage(Resource): + """Describes a Virtual Machine Extension Image. + + 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 id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param operating_system: The operating system this extension supports. + :type operating_system: str + :param compute_role: The type of role (IaaS or PaaS) this extension supports. + :type compute_role: str + :param handler_schema: The schema defined by publisher, where extension consumers should + provide settings in a matching schema. + :type handler_schema: str + :param vm_scale_set_enabled: Whether the extension can be used on xRP VMScaleSets. By default + existing extensions are usable on scalesets, but there might be cases where a publisher wants + to explicitly indicate the extension is only enabled for CRP VMs but not VMSS. + :type vm_scale_set_enabled: bool + :param supports_multiple_extensions: Whether the handler can support multiple extensions. + :type supports_multiple_extensions: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'operating_system': {'key': 'properties.operatingSystem', 'type': 'str'}, + 'compute_role': {'key': 'properties.computeRole', 'type': 'str'}, + 'handler_schema': {'key': 'properties.handlerSchema', 'type': 'str'}, + 'vm_scale_set_enabled': {'key': 'properties.vmScaleSetEnabled', 'type': 'bool'}, + 'supports_multiple_extensions': {'key': 'properties.supportsMultipleExtensions', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineExtensionImage, self).__init__(**kwargs) + self.operating_system = kwargs.get('operating_system', None) + self.compute_role = kwargs.get('compute_role', None) + self.handler_schema = kwargs.get('handler_schema', None) + self.vm_scale_set_enabled = kwargs.get('vm_scale_set_enabled', None) + self.supports_multiple_extensions = kwargs.get('supports_multiple_extensions', None) + + +class VirtualMachineExtensionInstanceView(msrest.serialization.Model): + """The instance view of a virtual machine extension. + + :param name: The virtual machine extension name. + :type name: str + :param type: Specifies the type of the extension; an example is "CustomScriptExtension". + :type type: str + :param type_handler_version: Specifies the version of the script handler. + :type type_handler_version: str + :param substatuses: The resource status information. + :type substatuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + :param statuses: The resource status information. + :type statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'type_handler_version': {'key': 'typeHandlerVersion', 'type': 'str'}, + 'substatuses': {'key': 'substatuses', 'type': '[InstanceViewStatus]'}, + 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineExtensionInstanceView, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) + self.type_handler_version = kwargs.get('type_handler_version', None) + self.substatuses = kwargs.get('substatuses', None) + self.statuses = kwargs.get('statuses', None) + + +class VirtualMachineExtensionsListResult(msrest.serialization.Model): + """The List Extension operation response. + + :param value: The list of extensions. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtension] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VirtualMachineExtension]'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineExtensionsListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class VirtualMachineExtensionUpdate(UpdateResource): + """Describes a Virtual Machine Extension. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :type force_update_tag: str + :param publisher: The name of the extension handler publisher. + :type publisher: str + :param type: Specifies the type of the extension; an example is "CustomScriptExtension". + :type type: str + :param type_handler_version: Specifies the version of the script handler. + :type type_handler_version: str + :param 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. + :type auto_upgrade_minor_version: bool + :param enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :type enable_automatic_upgrade: bool + :param settings: Json formatted public settings for the extension. + :type settings: object + :param protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :type protected_settings: object + """ + + _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'}, + 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, + 'enable_automatic_upgrade': {'key': 'properties.enableAutomaticUpgrade', 'type': 'bool'}, + 'settings': {'key': 'properties.settings', 'type': 'object'}, + 'protected_settings': {'key': 'properties.protectedSettings', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineExtensionUpdate, self).__init__(**kwargs) + self.force_update_tag = kwargs.get('force_update_tag', None) + self.publisher = kwargs.get('publisher', None) + self.type = kwargs.get('type', None) + self.type_handler_version = kwargs.get('type_handler_version', None) + self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', None) + self.enable_automatic_upgrade = kwargs.get('enable_automatic_upgrade', None) + self.settings = kwargs.get('settings', None) + self.protected_settings = kwargs.get('protected_settings', None) + + +class VirtualMachineHealthStatus(msrest.serialization.Model): + """The health status of the VM. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: The health status information for the VM. + :vartype status: ~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus + """ + + _validation = { + 'status': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'InstanceViewStatus'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineHealthStatus, self).__init__(**kwargs) + self.status = None + + +class VirtualMachineIdentity(msrest.serialization.Model): + """Identity for the virtual machine. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of virtual machine identity. This property will only be + provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant id associated with the virtual machine. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :param type: The type of identity used for the virtual machine. The type 'SystemAssigned, + UserAssigned' includes both an implicitly created identity and a set of user assigned + identities. The type 'None' will remove any identities from the virtual machine. Possible + values include: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". + :type type: str or ~azure.mgmt.compute.v2021_03_01.models.ResourceIdentityType + :param user_assigned_identities: The list of user identities associated with the Virtual + Machine. The user identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :type user_assigned_identities: dict[str, + ~azure.mgmt.compute.v2021_03_01.models.UserAssignedIdentitiesValue] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentitiesValue}'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineIdentity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = kwargs.get('type', None) + self.user_assigned_identities = kwargs.get('user_assigned_identities', None) + + +class VirtualMachineImageResource(SubResource): + """Virtual machine image resource information. + + All required parameters must be populated in order to send to Azure. + + :param id: Resource Id. + :type id: str + :param name: Required. The name of the resource. + :type name: str + :param location: Required. The supported Azure location of the resource. + :type location: str + :param tags: A set of tags. Specifies the tags that are assigned to the virtual machine. For + more information about using tags, see `Using tags to organize your Azure resources + `_. + :type tags: dict[str, str] + :param extended_location: The extended location of the Virtual Machine. + :type extended_location: ~azure.mgmt.compute.v2021_03_01.models.ExtendedLocation + """ + + _validation = { + 'name': {'required': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineImageResource, self).__init__(**kwargs) + self.name = kwargs['name'] + self.location = kwargs['location'] + self.tags = kwargs.get('tags', None) + self.extended_location = kwargs.get('extended_location', None) + + +class VirtualMachineImage(VirtualMachineImageResource): + """Describes a Virtual Machine Image. + + All required parameters must be populated in order to send to Azure. + + :param id: Resource Id. + :type id: str + :param name: Required. The name of the resource. + :type name: str + :param location: Required. The supported Azure location of the resource. + :type location: str + :param tags: A set of tags. Specifies the tags that are assigned to the virtual machine. For + more information about using tags, see `Using tags to organize your Azure resources + `_. + :type tags: dict[str, str] + :param extended_location: The extended location of the Virtual Machine. + :type extended_location: ~azure.mgmt.compute.v2021_03_01.models.ExtendedLocation + :param plan: Used for establishing the purchase context of any 3rd Party artifact through + MarketPlace. + :type plan: ~azure.mgmt.compute.v2021_03_01.models.PurchasePlan + :param os_disk_image: Contains the os disk image information. + :type os_disk_image: ~azure.mgmt.compute.v2021_03_01.models.OSDiskImage + :param data_disk_images: + :type data_disk_images: list[~azure.mgmt.compute.v2021_03_01.models.DataDiskImage] + :param automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the image. + :type automatic_os_upgrade_properties: + ~azure.mgmt.compute.v2021_03_01.models.AutomaticOSUpgradeProperties + :param hyper_v_generation: Specifies the HyperVGeneration Type. Possible values include: "V1", + "V2". + :type hyper_v_generation: str or ~azure.mgmt.compute.v2021_03_01.models.HyperVGenerationTypes + :param disallowed: Specifies disallowed configuration for the VirtualMachine created from the + image. + :type disallowed: ~azure.mgmt.compute.v2021_03_01.models.DisallowedConfiguration + :param features: + :type features: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineImageFeature] + """ + + _validation = { + 'name': {'required': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, + 'plan': {'key': 'properties.plan', 'type': 'PurchasePlan'}, + 'os_disk_image': {'key': 'properties.osDiskImage', 'type': 'OSDiskImage'}, + 'data_disk_images': {'key': 'properties.dataDiskImages', 'type': '[DataDiskImage]'}, + 'automatic_os_upgrade_properties': {'key': 'properties.automaticOSUpgradeProperties', 'type': 'AutomaticOSUpgradeProperties'}, + 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, + 'disallowed': {'key': 'properties.disallowed', 'type': 'DisallowedConfiguration'}, + 'features': {'key': 'properties.features', 'type': '[VirtualMachineImageFeature]'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineImage, self).__init__(**kwargs) + self.plan = kwargs.get('plan', None) + self.os_disk_image = kwargs.get('os_disk_image', None) + self.data_disk_images = kwargs.get('data_disk_images', None) + self.automatic_os_upgrade_properties = kwargs.get('automatic_os_upgrade_properties', None) + self.hyper_v_generation = kwargs.get('hyper_v_generation', None) + self.disallowed = kwargs.get('disallowed', None) + self.features = kwargs.get('features', None) + + +class VirtualMachineImageFeature(msrest.serialization.Model): + """Specifies additional capabilities supported by the image. + + :param name: The name of the feature. + :type name: str + :param value: The corresponding value for the feature. + :type value: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineImageFeature, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.value = kwargs.get('value', None) + + +class VirtualMachineInstallPatchesParameters(msrest.serialization.Model): + """Input for InstallPatches as directly received by the API. + + All required parameters must be populated in order to send to Azure. + + :param maximum_duration: Required. 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). + :type maximum_duration: str + :param reboot_setting: Required. Defines when it is acceptable to reboot a VM during a software + update operation. Possible values include: "IfRequired", "Never", "Always". + :type reboot_setting: str or ~azure.mgmt.compute.v2021_03_01.models.VMGuestPatchRebootSetting + :param windows_parameters: Input for InstallPatches on a Windows VM, as directly received by + the API. + :type windows_parameters: ~azure.mgmt.compute.v2021_03_01.models.WindowsParameters + :param linux_parameters: Input for InstallPatches on a Linux VM, as directly received by the + API. + :type linux_parameters: ~azure.mgmt.compute.v2021_03_01.models.LinuxParameters + """ + + _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'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineInstallPatchesParameters, self).__init__(**kwargs) + self.maximum_duration = kwargs['maximum_duration'] + self.reboot_setting = kwargs['reboot_setting'] + self.windows_parameters = kwargs.get('windows_parameters', None) + self.linux_parameters = kwargs.get('linux_parameters', None) + + +class VirtualMachineInstallPatchesResult(msrest.serialization.Model): + """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.". Possible values include: "Unknown", "InProgress", "Failed", + "Succeeded", "CompletedWithWarnings". + :vartype status: str or ~azure.mgmt.compute.v2021_03_01.models.PatchOperationStatus + :ivar installation_activity_id: The activity ID of the operation that produced this result. It + is used to correlate across CRP and extension logs. + :vartype installation_activity_id: str + :ivar reboot_status: The reboot state of the VM following completion of the operation. Possible + values include: "Unknown", "NotNeeded", "Required", "Started", "Failed", "Completed". + :vartype reboot_status: str or ~azure.mgmt.compute.v2021_03_01.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 patches: The patches that were installed during the operation. + :vartype patches: list[~azure.mgmt.compute.v2021_03_01.models.PatchInstallationDetail] + :ivar start_date_time: The UTC timestamp when the operation began. + :vartype start_date_time: ~datetime.datetime + :ivar error: The errors that were encountered during execution of the operation. The details + array contains the list of them. + :vartype error: ~azure.mgmt.compute.v2021_03_01.models.ApiError + """ + + _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}, + 'patches': {'readonly': True}, + 'start_date_time': {'readonly': True}, + 'error': {'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'}, + 'patches': {'key': 'patches', 'type': '[PatchInstallationDetail]'}, + 'start_date_time': {'key': 'startDateTime', 'type': 'iso-8601'}, + 'error': {'key': 'error', 'type': 'ApiError'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineInstallPatchesResult, self).__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.patches = None + self.start_date_time = None + self.error = None + + +class VirtualMachineInstanceView(msrest.serialization.Model): + """The instance view of a virtual machine. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param platform_update_domain: Specifies the update domain of the virtual machine. + :type platform_update_domain: int + :param platform_fault_domain: Specifies the fault domain of the virtual machine. + :type platform_fault_domain: int + :param computer_name: The computer name assigned to the virtual machine. + :type computer_name: str + :param os_name: The Operating System running on the virtual machine. + :type os_name: str + :param os_version: The version of Operating System running on the virtual machine. + :type os_version: str + :param hyper_v_generation: Specifies the HyperVGeneration Type associated with a resource. + Possible values include: "V1", "V2". + :type hyper_v_generation: str or ~azure.mgmt.compute.v2021_03_01.models.HyperVGenerationType + :param rdp_thumb_print: The Remote desktop certificate thumbprint. + :type rdp_thumb_print: str + :param vm_agent: The VM Agent running on the virtual machine. + :type vm_agent: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineAgentInstanceView + :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :type maintenance_redeploy_status: + ~azure.mgmt.compute.v2021_03_01.models.MaintenanceRedeployStatus + :param disks: The virtual machine disk information. + :type disks: list[~azure.mgmt.compute.v2021_03_01.models.DiskInstanceView] + :param extensions: The extensions information. + :type extensions: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtensionInstanceView] + :ivar vm_health: The health status for the VM. + :vartype vm_health: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineHealthStatus + :param boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + Console Output and Screenshot to diagnose VM status. :code:`
    `:code:`
    ` You can easily + view the output of your console log. :code:`
    `:code:`
    ` Azure also enables you to see a + screenshot of the VM from the hypervisor. + :type boot_diagnostics: ~azure.mgmt.compute.v2021_03_01.models.BootDiagnosticsInstanceView + :ivar assigned_host: Resource id of the dedicated host, on which the virtual machine is + allocated through automatic placement, when the virtual machine is associated with a dedicated + host group that has automatic placement enabled. :code:`
    `:code:`
    `Minimum api-version: + 2020-06-01. + :vartype assigned_host: str + :param statuses: The resource status information. + :type statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + :param patch_status: [Preview Feature] The status of virtual machine patch operations. + :type patch_status: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachinePatchStatus + """ + + _validation = { + 'vm_health': {'readonly': True}, + 'assigned_host': {'readonly': True}, + } + + _attribute_map = { + 'platform_update_domain': {'key': 'platformUpdateDomain', 'type': 'int'}, + 'platform_fault_domain': {'key': 'platformFaultDomain', 'type': 'int'}, + 'computer_name': {'key': 'computerName', 'type': 'str'}, + 'os_name': {'key': 'osName', 'type': 'str'}, + 'os_version': {'key': 'osVersion', 'type': 'str'}, + 'hyper_v_generation': {'key': 'hyperVGeneration', 'type': 'str'}, + 'rdp_thumb_print': {'key': 'rdpThumbPrint', 'type': 'str'}, + 'vm_agent': {'key': 'vmAgent', 'type': 'VirtualMachineAgentInstanceView'}, + 'maintenance_redeploy_status': {'key': 'maintenanceRedeployStatus', 'type': 'MaintenanceRedeployStatus'}, + 'disks': {'key': 'disks', 'type': '[DiskInstanceView]'}, + 'extensions': {'key': 'extensions', 'type': '[VirtualMachineExtensionInstanceView]'}, + 'vm_health': {'key': 'vmHealth', 'type': 'VirtualMachineHealthStatus'}, + 'boot_diagnostics': {'key': 'bootDiagnostics', 'type': 'BootDiagnosticsInstanceView'}, + 'assigned_host': {'key': 'assignedHost', 'type': 'str'}, + 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, + 'patch_status': {'key': 'patchStatus', 'type': 'VirtualMachinePatchStatus'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineInstanceView, self).__init__(**kwargs) + self.platform_update_domain = kwargs.get('platform_update_domain', None) + self.platform_fault_domain = kwargs.get('platform_fault_domain', None) + self.computer_name = kwargs.get('computer_name', None) + self.os_name = kwargs.get('os_name', None) + self.os_version = kwargs.get('os_version', None) + self.hyper_v_generation = kwargs.get('hyper_v_generation', None) + self.rdp_thumb_print = kwargs.get('rdp_thumb_print', None) + self.vm_agent = kwargs.get('vm_agent', None) + self.maintenance_redeploy_status = kwargs.get('maintenance_redeploy_status', None) + self.disks = kwargs.get('disks', None) + self.extensions = kwargs.get('extensions', None) + self.vm_health = None + self.boot_diagnostics = kwargs.get('boot_diagnostics', None) + self.assigned_host = None + self.statuses = kwargs.get('statuses', None) + self.patch_status = kwargs.get('patch_status', None) + + +class VirtualMachineListResult(msrest.serialization.Model): + """The List Virtual Machine operation response. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. The list of virtual machines. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachine] + :param next_link: The URI to fetch the next page of VMs. Call ListNext() with this URI to fetch + the next page of Virtual Machines. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VirtualMachine]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineListResult, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = kwargs.get('next_link', None) + + +class VirtualMachinePatchStatus(msrest.serialization.Model): + """The status of virtual machine patch operations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param available_patch_summary: The available patch summary of the latest assessment operation + for the virtual machine. + :type available_patch_summary: ~azure.mgmt.compute.v2021_03_01.models.AvailablePatchSummary + :param last_patch_installation_summary: The installation summary of the latest installation + operation for the virtual machine. + :type last_patch_installation_summary: + ~azure.mgmt.compute.v2021_03_01.models.LastPatchInstallationSummary + :ivar configuration_statuses: The enablement status of the specified patchMode. + :vartype configuration_statuses: + list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + """ + + _validation = { + 'configuration_statuses': {'readonly': True}, + } + + _attribute_map = { + 'available_patch_summary': {'key': 'availablePatchSummary', 'type': 'AvailablePatchSummary'}, + 'last_patch_installation_summary': {'key': 'lastPatchInstallationSummary', 'type': 'LastPatchInstallationSummary'}, + 'configuration_statuses': {'key': 'configurationStatuses', 'type': '[InstanceViewStatus]'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachinePatchStatus, self).__init__(**kwargs) + self.available_patch_summary = kwargs.get('available_patch_summary', None) + self.last_patch_installation_summary = kwargs.get('last_patch_installation_summary', None) + self.configuration_statuses = None + + +class VirtualMachineReimageParameters(msrest.serialization.Model): + """Parameters for Reimaging Virtual Machine. NOTE: Virtual Machine OS disk will always be reimaged. + + :param temp_disk: Specifies whether to reimage temp disk. Default value: false. Note: This temp + disk reimage parameter is only supported for VM/VMSS with Ephemeral OS disk. + :type temp_disk: bool + """ + + _attribute_map = { + 'temp_disk': {'key': 'tempDisk', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineReimageParameters, self).__init__(**kwargs) + self.temp_disk = kwargs.get('temp_disk', None) + + +class VirtualMachineRunCommand(Resource): + """Describes a Virtual Machine run command. + + 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 id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param source: The source of the run command script. + :type source: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommandScriptSource + :param parameters: The parameters used by the script. + :type parameters: list[~azure.mgmt.compute.v2021_03_01.models.RunCommandInputParameter] + :param protected_parameters: The parameters used by the script. + :type protected_parameters: + list[~azure.mgmt.compute.v2021_03_01.models.RunCommandInputParameter] + :param async_execution: Optional. If set to true, provisioning will complete as soon as the + script starts and will not wait for script to complete. + :type async_execution: bool + :param run_as_user: Specifies the user account on the VM when executing the run command. + :type run_as_user: str + :param run_as_password: Specifies the user account password on the VM when executing the run + command. + :type run_as_password: str + :param timeout_in_seconds: The timeout in seconds to execute the run command. + :type timeout_in_seconds: int + :param output_blob_uri: Specifies the Azure storage blob where script output stream will be + uploaded. + :type output_blob_uri: str + :param error_blob_uri: Specifies the Azure storage blob where script error stream will be + uploaded. + :type error_blob_uri: str + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :ivar instance_view: The virtual machine run command instance view. + :vartype instance_view: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommandInstanceView + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'instance_view': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'source': {'key': 'properties.source', 'type': 'VirtualMachineRunCommandScriptSource'}, + 'parameters': {'key': 'properties.parameters', 'type': '[RunCommandInputParameter]'}, + 'protected_parameters': {'key': 'properties.protectedParameters', 'type': '[RunCommandInputParameter]'}, + 'async_execution': {'key': 'properties.asyncExecution', 'type': 'bool'}, + 'run_as_user': {'key': 'properties.runAsUser', 'type': 'str'}, + 'run_as_password': {'key': 'properties.runAsPassword', 'type': 'str'}, + 'timeout_in_seconds': {'key': 'properties.timeoutInSeconds', 'type': 'int'}, + 'output_blob_uri': {'key': 'properties.outputBlobUri', 'type': 'str'}, + 'error_blob_uri': {'key': 'properties.errorBlobUri', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'instance_view': {'key': 'properties.instanceView', 'type': 'VirtualMachineRunCommandInstanceView'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineRunCommand, self).__init__(**kwargs) + self.source = kwargs.get('source', None) + self.parameters = kwargs.get('parameters', None) + self.protected_parameters = kwargs.get('protected_parameters', None) + self.async_execution = kwargs.get('async_execution', False) + self.run_as_user = kwargs.get('run_as_user', None) + self.run_as_password = kwargs.get('run_as_password', None) + self.timeout_in_seconds = kwargs.get('timeout_in_seconds', None) + self.output_blob_uri = kwargs.get('output_blob_uri', None) + self.error_blob_uri = kwargs.get('error_blob_uri', None) + self.provisioning_state = None + self.instance_view = None + + +class VirtualMachineRunCommandInstanceView(msrest.serialization.Model): + """The instance view of a virtual machine run command. + + :param execution_state: Script execution status. Possible values include: "Unknown", "Pending", + "Running", "Failed", "Succeeded", "TimedOut", "Canceled". + :type execution_state: str or ~azure.mgmt.compute.v2021_03_01.models.ExecutionState + :param execution_message: Communicate script configuration errors or execution messages. + :type execution_message: str + :param exit_code: Exit code returned from script execution. + :type exit_code: int + :param output: Script output stream. + :type output: str + :param error: Script error stream. + :type error: str + :param start_time: Script start time. + :type start_time: ~datetime.datetime + :param end_time: Script end time. + :type end_time: ~datetime.datetime + :param statuses: The resource status information. + :type statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + """ + + _attribute_map = { + 'execution_state': {'key': 'executionState', 'type': 'str'}, + 'execution_message': {'key': 'executionMessage', 'type': 'str'}, + 'exit_code': {'key': 'exitCode', 'type': 'int'}, + 'output': {'key': 'output', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineRunCommandInstanceView, self).__init__(**kwargs) + self.execution_state = kwargs.get('execution_state', None) + self.execution_message = kwargs.get('execution_message', None) + self.exit_code = kwargs.get('exit_code', None) + self.output = kwargs.get('output', None) + self.error = kwargs.get('error', None) + self.start_time = kwargs.get('start_time', None) + self.end_time = kwargs.get('end_time', None) + self.statuses = kwargs.get('statuses', None) + + +class VirtualMachineRunCommandScriptSource(msrest.serialization.Model): + """Describes the script sources for run command. + + :param script: Specifies the script content to be executed on the VM. + :type script: str + :param script_uri: Specifies the script download location. + :type script_uri: str + :param command_id: Specifies a commandId of predefined built-in script. + :type command_id: str + """ + + _attribute_map = { + 'script': {'key': 'script', 'type': 'str'}, + 'script_uri': {'key': 'scriptUri', 'type': 'str'}, + 'command_id': {'key': 'commandId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineRunCommandScriptSource, self).__init__(**kwargs) + self.script = kwargs.get('script', None) + self.script_uri = kwargs.get('script_uri', None) + self.command_id = kwargs.get('command_id', None) + + +class VirtualMachineRunCommandsListResult(msrest.serialization.Model): + """The List run command operation response. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. The list of run commands. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommand] + :param next_link: The uri to fetch the next page of run commands. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VirtualMachineRunCommand]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineRunCommandsListResult, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = kwargs.get('next_link', None) + + +class VirtualMachineRunCommandUpdate(UpdateResource): + """Describes a Virtual Machine run command. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param source: The source of the run command script. + :type source: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommandScriptSource + :param parameters: The parameters used by the script. + :type parameters: list[~azure.mgmt.compute.v2021_03_01.models.RunCommandInputParameter] + :param protected_parameters: The parameters used by the script. + :type protected_parameters: + list[~azure.mgmt.compute.v2021_03_01.models.RunCommandInputParameter] + :param async_execution: Optional. If set to true, provisioning will complete as soon as the + script starts and will not wait for script to complete. + :type async_execution: bool + :param run_as_user: Specifies the user account on the VM when executing the run command. + :type run_as_user: str + :param run_as_password: Specifies the user account password on the VM when executing the run + command. + :type run_as_password: str + :param timeout_in_seconds: The timeout in seconds to execute the run command. + :type timeout_in_seconds: int + :param output_blob_uri: Specifies the Azure storage blob where script output stream will be + uploaded. + :type output_blob_uri: str + :param error_blob_uri: Specifies the Azure storage blob where script error stream will be + uploaded. + :type error_blob_uri: str + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :ivar instance_view: The virtual machine run command instance view. + :vartype instance_view: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommandInstanceView + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'instance_view': {'readonly': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'source': {'key': 'properties.source', 'type': 'VirtualMachineRunCommandScriptSource'}, + 'parameters': {'key': 'properties.parameters', 'type': '[RunCommandInputParameter]'}, + 'protected_parameters': {'key': 'properties.protectedParameters', 'type': '[RunCommandInputParameter]'}, + 'async_execution': {'key': 'properties.asyncExecution', 'type': 'bool'}, + 'run_as_user': {'key': 'properties.runAsUser', 'type': 'str'}, + 'run_as_password': {'key': 'properties.runAsPassword', 'type': 'str'}, + 'timeout_in_seconds': {'key': 'properties.timeoutInSeconds', 'type': 'int'}, + 'output_blob_uri': {'key': 'properties.outputBlobUri', 'type': 'str'}, + 'error_blob_uri': {'key': 'properties.errorBlobUri', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'instance_view': {'key': 'properties.instanceView', 'type': 'VirtualMachineRunCommandInstanceView'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineRunCommandUpdate, self).__init__(**kwargs) + self.source = kwargs.get('source', None) + self.parameters = kwargs.get('parameters', None) + self.protected_parameters = kwargs.get('protected_parameters', None) + self.async_execution = kwargs.get('async_execution', False) + self.run_as_user = kwargs.get('run_as_user', None) + self.run_as_password = kwargs.get('run_as_password', None) + self.timeout_in_seconds = kwargs.get('timeout_in_seconds', None) + self.output_blob_uri = kwargs.get('output_blob_uri', None) + self.error_blob_uri = kwargs.get('error_blob_uri', None) + self.provisioning_state = None + self.instance_view = None + + +class VirtualMachineScaleSet(Resource): + """Describes a Virtual Machine Scale Set. + + 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 id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: The virtual machine scale set sku. + :type sku: ~azure.mgmt.compute.v2021_03_01.models.Sku + :param plan: Specifies information about the marketplace image used to create the virtual + machine. This element is only used for marketplace images. Before you can use a marketplace + image from an API, you must enable the image for programmatic use. In the Azure portal, find + the marketplace image that you want to use and then click **Want to deploy programmatically, + Get Started ->**. Enter any required information and then click **Save**. + :type plan: ~azure.mgmt.compute.v2021_03_01.models.Plan + :param identity: The identity of the virtual machine scale set, if configured. + :type identity: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetIdentity + :param zones: The virtual machine scale set zones. NOTE: Availability zones can only be set + when you create the scale set. + :type zones: list[str] + :param extended_location: The extended location of the Virtual Machine Scale Set. + :type extended_location: ~azure.mgmt.compute.v2021_03_01.models.ExtendedLocation + :param upgrade_policy: The upgrade policy. + :type upgrade_policy: ~azure.mgmt.compute.v2021_03_01.models.UpgradePolicy + :param automatic_repairs_policy: Policy for automatic repairs. + :type automatic_repairs_policy: ~azure.mgmt.compute.v2021_03_01.models.AutomaticRepairsPolicy + :param virtual_machine_profile: The virtual machine profile. + :type virtual_machine_profile: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMProfile + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :param overprovision: Specifies whether the Virtual Machine Scale Set should be + overprovisioned. + :type overprovision: bool + :param do_not_run_extensions_on_overprovisioned_v_ms: When Overprovision is enabled, extensions + are launched only on the requested number of VMs which are finally kept. This property will + hence ensure that the extensions do not run on the extra overprovisioned VMs. + :type do_not_run_extensions_on_overprovisioned_v_ms: bool + :ivar unique_id: Specifies the ID which uniquely identifies a Virtual Machine Scale Set. + :vartype unique_id: str + :param single_placement_group: When true this limits the scale set to a single placement group, + of max size 100 virtual machines. NOTE: If singlePlacementGroup is true, it may be modified to + false. However, if singlePlacementGroup is false, it may not be modified to true. + :type single_placement_group: bool + :param zone_balance: Whether to force strictly even Virtual Machine distribution cross x-zones + in case there is zone outage. + :type zone_balance: bool + :param platform_fault_domain_count: Fault Domain count for each placement group. + :type platform_fault_domain_count: int + :param proximity_placement_group: Specifies information about the proximity placement group + that the virtual machine scale set should be assigned to. :code:`
    `:code:`
    `Minimum api- + version: 2018-04-01. + :type proximity_placement_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param host_group: Specifies information about the dedicated host group that the virtual + machine scale set resides in. :code:`
    `:code:`
    `Minimum api-version: 2020-06-01. + :type host_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + Virtual Machines in the Virtual Machine Scale Set. For instance: whether the Virtual Machines + have the capability to support attaching managed data disks with UltraSSD_LRS storage account + type. + :type additional_capabilities: ~azure.mgmt.compute.v2021_03_01.models.AdditionalCapabilities + :param scale_in_policy: Specifies the scale-in policy that decides which virtual machines are + chosen for removal when a Virtual Machine Scale Set is scaled-in. + :type scale_in_policy: ~azure.mgmt.compute.v2021_03_01.models.ScaleInPolicy + :param orchestration_mode: Specifies the orchestration mode for the virtual machine scale set. + Possible values include: "Uniform", "Flexible". + :type orchestration_mode: str or ~azure.mgmt.compute.v2021_03_01.models.OrchestrationMode + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'unique_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'plan': {'key': 'plan', 'type': 'Plan'}, + 'identity': {'key': 'identity', 'type': 'VirtualMachineScaleSetIdentity'}, + 'zones': {'key': 'zones', 'type': '[str]'}, + 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, + 'upgrade_policy': {'key': 'properties.upgradePolicy', 'type': 'UpgradePolicy'}, + 'automatic_repairs_policy': {'key': 'properties.automaticRepairsPolicy', 'type': 'AutomaticRepairsPolicy'}, + 'virtual_machine_profile': {'key': 'properties.virtualMachineProfile', 'type': 'VirtualMachineScaleSetVMProfile'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'overprovision': {'key': 'properties.overprovision', 'type': 'bool'}, + 'do_not_run_extensions_on_overprovisioned_v_ms': {'key': 'properties.doNotRunExtensionsOnOverprovisionedVMs', 'type': 'bool'}, + 'unique_id': {'key': 'properties.uniqueId', 'type': 'str'}, + 'single_placement_group': {'key': 'properties.singlePlacementGroup', 'type': 'bool'}, + 'zone_balance': {'key': 'properties.zoneBalance', 'type': 'bool'}, + 'platform_fault_domain_count': {'key': 'properties.platformFaultDomainCount', 'type': 'int'}, + 'proximity_placement_group': {'key': 'properties.proximityPlacementGroup', 'type': 'SubResource'}, + 'host_group': {'key': 'properties.hostGroup', 'type': 'SubResource'}, + 'additional_capabilities': {'key': 'properties.additionalCapabilities', 'type': 'AdditionalCapabilities'}, + 'scale_in_policy': {'key': 'properties.scaleInPolicy', 'type': 'ScaleInPolicy'}, + 'orchestration_mode': {'key': 'properties.orchestrationMode', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSet, self).__init__(**kwargs) + self.sku = kwargs.get('sku', None) + self.plan = kwargs.get('plan', None) + self.identity = kwargs.get('identity', None) + self.zones = kwargs.get('zones', None) + self.extended_location = kwargs.get('extended_location', None) + self.upgrade_policy = kwargs.get('upgrade_policy', None) + self.automatic_repairs_policy = kwargs.get('automatic_repairs_policy', None) + self.virtual_machine_profile = kwargs.get('virtual_machine_profile', None) + self.provisioning_state = None + self.overprovision = kwargs.get('overprovision', None) + self.do_not_run_extensions_on_overprovisioned_v_ms = kwargs.get('do_not_run_extensions_on_overprovisioned_v_ms', None) + self.unique_id = None + self.single_placement_group = kwargs.get('single_placement_group', None) + self.zone_balance = kwargs.get('zone_balance', None) + self.platform_fault_domain_count = kwargs.get('platform_fault_domain_count', None) + self.proximity_placement_group = kwargs.get('proximity_placement_group', None) + self.host_group = kwargs.get('host_group', None) + self.additional_capabilities = kwargs.get('additional_capabilities', None) + self.scale_in_policy = kwargs.get('scale_in_policy', None) + self.orchestration_mode = kwargs.get('orchestration_mode', None) + + +class VirtualMachineScaleSetDataDisk(msrest.serialization.Model): + """Describes a virtual machine scale set data disk. + + All required parameters must be populated in order to send to Azure. + + :param name: The disk name. + :type name: str + :param lun: Required. Specifies the logical unit number of the data disk. This value is used to + identify data disks within the VM and therefore must be unique for each data disk attached to a + VM. + :type lun: int + :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + are: :code:`
    `:code:`
    ` **None** :code:`
    `:code:`
    ` **ReadOnly** + :code:`
    `:code:`
    ` **ReadWrite** :code:`
    `:code:`
    ` Default: **None for Standard + storage. ReadOnly for Premium storage**. Possible values include: "None", "ReadOnly", + "ReadWrite". + :type caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes + :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :type write_accelerator_enabled: bool + :param create_option: Required. The create option. Possible values include: "FromImage", + "Empty", "Attach". + :type create_option: str or ~azure.mgmt.compute.v2021_03_01.models.DiskCreateOptionTypes + :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + used to overwrite the size of the disk in a virtual machine image. :code:`
    `:code:`
    ` + This value cannot be larger than 1023 GB. + :type disk_size_gb: int + :param managed_disk: The managed disk parameters. + :type managed_disk: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetManagedDiskParameters + :param disk_iops_read_write: Specifies the Read-Write IOPS for the managed disk. Should be used + only when StorageAccountType is UltraSSD_LRS. If not specified, a default value would be + assigned based on diskSizeGB. + :type disk_iops_read_write: long + :param disk_m_bps_read_write: Specifies the bandwidth in MB per second for the managed disk. + Should be used only when StorageAccountType is UltraSSD_LRS. If not specified, a default value + would be assigned based on diskSizeGB. + :type disk_m_bps_read_write: long + """ + + _validation = { + 'lun': {'required': True}, + 'create_option': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'lun': {'key': 'lun', 'type': 'int'}, + 'caching': {'key': 'caching', 'type': 'str'}, + 'write_accelerator_enabled': {'key': 'writeAcceleratorEnabled', 'type': 'bool'}, + 'create_option': {'key': 'createOption', 'type': 'str'}, + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, + 'managed_disk': {'key': 'managedDisk', 'type': 'VirtualMachineScaleSetManagedDiskParameters'}, + 'disk_iops_read_write': {'key': 'diskIOPSReadWrite', 'type': 'long'}, + 'disk_m_bps_read_write': {'key': 'diskMBpsReadWrite', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetDataDisk, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.lun = kwargs['lun'] + self.caching = kwargs.get('caching', None) + self.write_accelerator_enabled = kwargs.get('write_accelerator_enabled', None) + self.create_option = kwargs['create_option'] + self.disk_size_gb = kwargs.get('disk_size_gb', None) + self.managed_disk = kwargs.get('managed_disk', None) + self.disk_iops_read_write = kwargs.get('disk_iops_read_write', None) + self.disk_m_bps_read_write = kwargs.get('disk_m_bps_read_write', None) + + +class VirtualMachineScaleSetExtension(SubResourceReadOnly): + """Describes a Virtual Machine Scale Set Extension. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :param name: The name of the extension. + :type name: str + :ivar type: Resource type. + :vartype type: str + :param force_update_tag: If a value is provided and is different from the previous value, the + extension handler will be forced to update even if the extension configuration has not changed. + :type force_update_tag: str + :param publisher: The name of the extension handler publisher. + :type publisher: str + :param type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :type type_properties_type: str + :param type_handler_version: Specifies the version of the script handler. + :type type_handler_version: str + :param 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. + :type auto_upgrade_minor_version: bool + :param enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :type enable_automatic_upgrade: bool + :param settings: Json formatted public settings for the extension. + :type settings: object + :param protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :type protected_settings: object + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :param provision_after_extensions: Collection of extension names after which this extension + needs to be provisioned. + :type provision_after_extensions: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', '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'}, + 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, + 'enable_automatic_upgrade': {'key': 'properties.enableAutomaticUpgrade', 'type': 'bool'}, + 'settings': {'key': 'properties.settings', 'type': 'object'}, + 'protected_settings': {'key': 'properties.protectedSettings', 'type': 'object'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'provision_after_extensions': {'key': 'properties.provisionAfterExtensions', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetExtension, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.type = None + self.force_update_tag = kwargs.get('force_update_tag', None) + self.publisher = kwargs.get('publisher', None) + self.type_properties_type = kwargs.get('type_properties_type', None) + self.type_handler_version = kwargs.get('type_handler_version', None) + self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', None) + self.enable_automatic_upgrade = kwargs.get('enable_automatic_upgrade', None) + self.settings = kwargs.get('settings', None) + self.protected_settings = kwargs.get('protected_settings', None) + self.provisioning_state = None + self.provision_after_extensions = kwargs.get('provision_after_extensions', None) + + +class VirtualMachineScaleSetExtensionListResult(msrest.serialization.Model): + """The List VM scale set extension operation response. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. The list of VM scale set extensions. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetExtension] + :param next_link: The uri to fetch the next page of VM scale set extensions. Call ListNext() + with this to fetch the next page of VM scale set extensions. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VirtualMachineScaleSetExtension]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetExtensionListResult, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = kwargs.get('next_link', None) + + +class VirtualMachineScaleSetExtensionProfile(msrest.serialization.Model): + """Describes a virtual machine scale set extension profile. + + :param extensions: The virtual machine scale set child extension resources. + :type extensions: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetExtension] + :param extensions_time_budget: Specifies the time alloted for all extensions to start. The time + duration should be between 15 minutes and 120 minutes (inclusive) and should be specified in + ISO 8601 format. The default value is 90 minutes (PT1H30M). :code:`
    `:code:`
    ` Minimum + api-version: 2020-06-01. + :type extensions_time_budget: str + """ + + _attribute_map = { + 'extensions': {'key': 'extensions', 'type': '[VirtualMachineScaleSetExtension]'}, + 'extensions_time_budget': {'key': 'extensionsTimeBudget', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetExtensionProfile, self).__init__(**kwargs) + self.extensions = kwargs.get('extensions', None) + self.extensions_time_budget = kwargs.get('extensions_time_budget', None) + + +class VirtualMachineScaleSetExtensionUpdate(SubResourceReadOnly): + """Describes a Virtual Machine Scale Set Extension. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: The name of the extension. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param force_update_tag: If a value is provided and is different from the previous value, the + extension handler will be forced to update even if the extension configuration has not changed. + :type force_update_tag: str + :param publisher: The name of the extension handler publisher. + :type publisher: str + :param type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :type type_properties_type: str + :param type_handler_version: Specifies the version of the script handler. + :type type_handler_version: str + :param 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. + :type auto_upgrade_minor_version: bool + :param enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :type enable_automatic_upgrade: bool + :param settings: Json formatted public settings for the extension. + :type settings: object + :param protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :type protected_settings: object + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :param provision_after_extensions: Collection of extension names after which this extension + needs to be provisioned. + :type provision_after_extensions: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', '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'}, + 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, + 'enable_automatic_upgrade': {'key': 'properties.enableAutomaticUpgrade', 'type': 'bool'}, + 'settings': {'key': 'properties.settings', 'type': 'object'}, + 'protected_settings': {'key': 'properties.protectedSettings', 'type': 'object'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'provision_after_extensions': {'key': 'properties.provisionAfterExtensions', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetExtensionUpdate, self).__init__(**kwargs) + self.name = None + self.type = None + self.force_update_tag = kwargs.get('force_update_tag', None) + self.publisher = kwargs.get('publisher', None) + self.type_properties_type = kwargs.get('type_properties_type', None) + self.type_handler_version = kwargs.get('type_handler_version', None) + self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', None) + self.enable_automatic_upgrade = kwargs.get('enable_automatic_upgrade', None) + self.settings = kwargs.get('settings', None) + self.protected_settings = kwargs.get('protected_settings', None) + self.provisioning_state = None + self.provision_after_extensions = kwargs.get('provision_after_extensions', None) + + +class VirtualMachineScaleSetIdentity(msrest.serialization.Model): + """Identity for the virtual machine scale set. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of virtual machine scale set identity. This property will + only be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant id associated with the virtual machine scale set. This property + will only be provided for a system assigned identity. + :vartype tenant_id: str + :param type: The type of identity used for the virtual machine scale set. The type + 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user + assigned identities. The type 'None' will remove any identities from the virtual machine scale + set. Possible values include: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", + "None". + :type type: str or ~azure.mgmt.compute.v2021_03_01.models.ResourceIdentityType + :param user_assigned_identities: The list of user identities associated with the virtual + machine scale set. The user identity dictionary key references will be ARM resource ids in the + form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :type user_assigned_identities: dict[str, + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue}'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetIdentity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = kwargs.get('type', None) + self.user_assigned_identities = kwargs.get('user_assigned_identities', None) + + +class VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue(msrest.serialization.Model): + """VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class VirtualMachineScaleSetInstanceView(msrest.serialization.Model): + """The instance view of a virtual machine scale set. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar virtual_machine: The instance view status summary for the virtual machine scale set. + :vartype virtual_machine: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetInstanceViewStatusesSummary + :ivar extensions: The extensions information. + :vartype extensions: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMExtensionsSummary] + :param statuses: The resource status information. + :type statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + :ivar orchestration_services: The orchestration services information. + :vartype orchestration_services: + list[~azure.mgmt.compute.v2021_03_01.models.OrchestrationServiceSummary] + """ + + _validation = { + 'virtual_machine': {'readonly': True}, + 'extensions': {'readonly': True}, + 'orchestration_services': {'readonly': True}, + } + + _attribute_map = { + 'virtual_machine': {'key': 'virtualMachine', 'type': 'VirtualMachineScaleSetInstanceViewStatusesSummary'}, + 'extensions': {'key': 'extensions', 'type': '[VirtualMachineScaleSetVMExtensionsSummary]'}, + 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, + 'orchestration_services': {'key': 'orchestrationServices', 'type': '[OrchestrationServiceSummary]'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetInstanceView, self).__init__(**kwargs) + self.virtual_machine = None + self.extensions = None + self.statuses = kwargs.get('statuses', None) + self.orchestration_services = None + + +class VirtualMachineScaleSetInstanceViewStatusesSummary(msrest.serialization.Model): + """Instance view statuses summary for virtual machines of a virtual machine scale set. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar statuses_summary: The extensions information. + :vartype statuses_summary: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineStatusCodeCount] + """ + + _validation = { + 'statuses_summary': {'readonly': True}, + } + + _attribute_map = { + 'statuses_summary': {'key': 'statusesSummary', 'type': '[VirtualMachineStatusCodeCount]'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetInstanceViewStatusesSummary, self).__init__(**kwargs) + self.statuses_summary = None + + +class VirtualMachineScaleSetIPConfiguration(SubResource): + """Describes a virtual machine scale set network profile's IP configuration. + + All required parameters must be populated in order to send to Azure. + + :param id: Resource Id. + :type id: str + :param name: Required. The IP configuration name. + :type name: str + :param subnet: Specifies the identifier of the subnet. + :type subnet: ~azure.mgmt.compute.v2021_03_01.models.ApiEntityReference + :param primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :type primary: bool + :param public_ip_address_configuration: The publicIPAddressConfiguration. + :type public_ip_address_configuration: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetPublicIPAddressConfiguration + :param private_ip_address_version: Available from Api-Version 2017-03-30 onwards, it represents + whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible + values are: 'IPv4' and 'IPv6'. Possible values include: "IPv4", "IPv6". + :type private_ip_address_version: str or ~azure.mgmt.compute.v2021_03_01.models.IPVersion + :param application_gateway_backend_address_pools: Specifies an array of references to backend + address pools of application gateways. A scale set can reference backend address pools of + multiple application gateways. Multiple scale sets cannot use the same application gateway. + :type application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + :param application_security_groups: Specifies an array of references to application security + group. + :type application_security_groups: list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + :param load_balancer_backend_address_pools: Specifies an array of references to backend address + pools of load balancers. A scale set can reference backend address pools of one public and one + internal load balancer. Multiple scale sets cannot use the same basic sku load balancer. + :type load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + :param load_balancer_inbound_nat_pools: Specifies an array of references to inbound Nat pools + of the load balancers. A scale set can reference inbound nat pools of one public and one + internal load balancer. Multiple scale sets cannot use the same basic sku load balancer. + :type load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'subnet': {'key': 'properties.subnet', 'type': 'ApiEntityReference'}, + 'primary': {'key': 'properties.primary', 'type': 'bool'}, + 'public_ip_address_configuration': {'key': 'properties.publicIPAddressConfiguration', 'type': 'VirtualMachineScaleSetPublicIPAddressConfiguration'}, + 'private_ip_address_version': {'key': 'properties.privateIPAddressVersion', 'type': 'str'}, + 'application_gateway_backend_address_pools': {'key': 'properties.applicationGatewayBackendAddressPools', 'type': '[SubResource]'}, + 'application_security_groups': {'key': 'properties.applicationSecurityGroups', 'type': '[SubResource]'}, + 'load_balancer_backend_address_pools': {'key': 'properties.loadBalancerBackendAddressPools', 'type': '[SubResource]'}, + 'load_balancer_inbound_nat_pools': {'key': 'properties.loadBalancerInboundNatPools', 'type': '[SubResource]'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetIPConfiguration, self).__init__(**kwargs) + self.name = kwargs['name'] + self.subnet = kwargs.get('subnet', None) + self.primary = kwargs.get('primary', None) + self.public_ip_address_configuration = kwargs.get('public_ip_address_configuration', None) + self.private_ip_address_version = kwargs.get('private_ip_address_version', None) + self.application_gateway_backend_address_pools = kwargs.get('application_gateway_backend_address_pools', None) + self.application_security_groups = kwargs.get('application_security_groups', None) + self.load_balancer_backend_address_pools = kwargs.get('load_balancer_backend_address_pools', None) + self.load_balancer_inbound_nat_pools = kwargs.get('load_balancer_inbound_nat_pools', None) + + +class VirtualMachineScaleSetIpTag(msrest.serialization.Model): + """Contains the IP tag associated with the public IP address. + + :param ip_tag_type: IP tag type. Example: FirstPartyUsage. + :type ip_tag_type: str + :param tag: IP tag associated with the public IP. Example: SQL, Storage etc. + :type tag: str + """ + + _attribute_map = { + 'ip_tag_type': {'key': 'ipTagType', 'type': 'str'}, + 'tag': {'key': 'tag', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetIpTag, self).__init__(**kwargs) + self.ip_tag_type = kwargs.get('ip_tag_type', None) + self.tag = kwargs.get('tag', None) + + +class VirtualMachineScaleSetListOSUpgradeHistory(msrest.serialization.Model): + """List of Virtual Machine Scale Set OS Upgrade History operation response. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. The list of OS upgrades performed on the virtual machine scale set. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.UpgradeOperationHistoricalStatusInfo] + :param next_link: The uri to fetch the next page of OS Upgrade History. Call ListNext() with + this to fetch the next page of history of upgrades. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[UpgradeOperationHistoricalStatusInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetListOSUpgradeHistory, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = kwargs.get('next_link', None) + + +class VirtualMachineScaleSetListResult(msrest.serialization.Model): + """The List Virtual Machine operation response. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. The list of virtual machine scale sets. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSet] + :param next_link: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() + with this to fetch the next page of VMSS. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VirtualMachineScaleSet]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetListResult, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = kwargs.get('next_link', None) + + +class VirtualMachineScaleSetListSkusResult(msrest.serialization.Model): + """The Virtual Machine Scale Set List Skus operation response. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. The list of skus available for the virtual machine scale set. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetSku] + :param next_link: The uri to fetch the next page of Virtual Machine Scale Set Skus. Call + ListNext() with this to fetch the next page of VMSS Skus. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VirtualMachineScaleSetSku]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetListSkusResult, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = kwargs.get('next_link', None) + + +class VirtualMachineScaleSetListWithLinkResult(msrest.serialization.Model): + """The List Virtual Machine operation response. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. The list of virtual machine scale sets. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSet] + :param next_link: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() + with this to fetch the next page of Virtual Machine Scale Sets. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VirtualMachineScaleSet]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetListWithLinkResult, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = kwargs.get('next_link', None) + + +class VirtualMachineScaleSetManagedDiskParameters(msrest.serialization.Model): + """Describes the parameters of a ScaleSet managed disk. + + :param storage_account_type: Specifies the storage account type for the managed disk. NOTE: + UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. Possible values + include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", + "StandardSSD_ZRS". + :type storage_account_type: str or ~azure.mgmt.compute.v2021_03_01.models.StorageAccountTypes + :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + the managed disk. + :type disk_encryption_set: ~azure.mgmt.compute.v2021_03_01.models.DiskEncryptionSetParameters + """ + + _attribute_map = { + 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, + 'disk_encryption_set': {'key': 'diskEncryptionSet', 'type': 'DiskEncryptionSetParameters'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetManagedDiskParameters, self).__init__(**kwargs) + self.storage_account_type = kwargs.get('storage_account_type', None) + self.disk_encryption_set = kwargs.get('disk_encryption_set', None) + + +class VirtualMachineScaleSetNetworkConfiguration(SubResource): + """Describes a virtual machine scale set network profile's network configurations. + + All required parameters must be populated in order to send to Azure. + + :param id: Resource Id. + :type id: str + :param name: Required. The network configuration name. + :type name: str + :param primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :type primary: bool + :param enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :type enable_accelerated_networking: bool + :param enable_fpga: Specifies whether the network interface is FPGA networking-enabled. + :type enable_fpga: bool + :param network_security_group: The network security group. + :type network_security_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param dns_settings: The dns settings to be applied on the network interfaces. + :type dns_settings: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings + :param ip_configurations: Specifies the IP configurations of the network interface. + :type ip_configurations: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetIPConfiguration] + :param enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :type enable_ip_forwarding: bool + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'primary': {'key': 'properties.primary', 'type': 'bool'}, + 'enable_accelerated_networking': {'key': 'properties.enableAcceleratedNetworking', 'type': 'bool'}, + 'enable_fpga': {'key': 'properties.enableFpga', 'type': 'bool'}, + 'network_security_group': {'key': 'properties.networkSecurityGroup', 'type': 'SubResource'}, + 'dns_settings': {'key': 'properties.dnsSettings', 'type': 'VirtualMachineScaleSetNetworkConfigurationDnsSettings'}, + 'ip_configurations': {'key': 'properties.ipConfigurations', 'type': '[VirtualMachineScaleSetIPConfiguration]'}, + 'enable_ip_forwarding': {'key': 'properties.enableIPForwarding', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetNetworkConfiguration, self).__init__(**kwargs) + self.name = kwargs['name'] + self.primary = kwargs.get('primary', None) + self.enable_accelerated_networking = kwargs.get('enable_accelerated_networking', None) + self.enable_fpga = kwargs.get('enable_fpga', None) + self.network_security_group = kwargs.get('network_security_group', None) + self.dns_settings = kwargs.get('dns_settings', None) + self.ip_configurations = kwargs.get('ip_configurations', None) + self.enable_ip_forwarding = kwargs.get('enable_ip_forwarding', None) + + +class VirtualMachineScaleSetNetworkConfigurationDnsSettings(msrest.serialization.Model): + """Describes a virtual machines scale sets network configuration's DNS settings. + + :param dns_servers: List of DNS servers IP addresses. + :type dns_servers: list[str] + """ + + _attribute_map = { + 'dns_servers': {'key': 'dnsServers', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetNetworkConfigurationDnsSettings, self).__init__(**kwargs) + self.dns_servers = kwargs.get('dns_servers', None) + + +class VirtualMachineScaleSetNetworkProfile(msrest.serialization.Model): + """Describes a virtual machine scale set network profile. + + :param health_probe: A reference to a load balancer probe used to determine the health of an + instance in the virtual machine scale set. The reference will be in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. + :type health_probe: ~azure.mgmt.compute.v2021_03_01.models.ApiEntityReference + :param network_interface_configurations: The list of network configurations. + :type network_interface_configurations: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetNetworkConfiguration] + """ + + _attribute_map = { + 'health_probe': {'key': 'healthProbe', 'type': 'ApiEntityReference'}, + 'network_interface_configurations': {'key': 'networkInterfaceConfigurations', 'type': '[VirtualMachineScaleSetNetworkConfiguration]'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetNetworkProfile, self).__init__(**kwargs) + self.health_probe = kwargs.get('health_probe', None) + self.network_interface_configurations = kwargs.get('network_interface_configurations', None) + + +class VirtualMachineScaleSetOSDisk(msrest.serialization.Model): + """Describes a virtual machine scale set operating system disk. + + All required parameters must be populated in order to send to Azure. + + :param name: The disk name. + :type name: str + :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + are: :code:`
    `:code:`
    ` **None** :code:`
    `:code:`
    ` **ReadOnly** + :code:`
    `:code:`
    ` **ReadWrite** :code:`
    `:code:`
    ` Default: **None for Standard + storage. ReadOnly for Premium storage**. Possible values include: "None", "ReadOnly", + "ReadWrite". + :type caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes + :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :type write_accelerator_enabled: bool + :param create_option: Required. Specifies how the virtual machines in the scale set should be + created.:code:`
    `:code:`
    ` The only allowed value is: **FromImage** \u2013 This value is + used when you are using an image to create the virtual machine. If you are using a platform + image, you also use the imageReference element described above. If you are using a marketplace + image, you also use the plan element previously described. Possible values include: + "FromImage", "Empty", "Attach". + :type create_option: str or ~azure.mgmt.compute.v2021_03_01.models.DiskCreateOptionTypes + :param diff_disk_settings: Specifies the ephemeral disk Settings for the operating system disk + used by the virtual machine scale set. + :type diff_disk_settings: ~azure.mgmt.compute.v2021_03_01.models.DiffDiskSettings + :param disk_size_gb: Specifies the size of the operating system disk in gigabytes. This element + can be used to overwrite the size of the disk in a virtual machine image. + :code:`
    `:code:`
    ` This value cannot be larger than 1023 GB. + :type disk_size_gb: int + :param os_type: This property allows you to specify the type of the OS that is included in the + disk if creating a VM from user-image or a specialized VHD. :code:`
    `:code:`
    ` Possible + values are: :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible + values include: "Windows", "Linux". + :type os_type: str or ~azure.mgmt.compute.v2021_03_01.models.OperatingSystemTypes + :param image: Specifies information about the unmanaged user image to base the scale set on. + :type image: ~azure.mgmt.compute.v2021_03_01.models.VirtualHardDisk + :param vhd_containers: Specifies the container urls that are used to store operating system + disks for the scale set. + :type vhd_containers: list[str] + :param managed_disk: The managed disk parameters. + :type managed_disk: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetManagedDiskParameters + """ + + _validation = { + 'create_option': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'caching': {'key': 'caching', 'type': 'str'}, + 'write_accelerator_enabled': {'key': 'writeAcceleratorEnabled', 'type': 'bool'}, + 'create_option': {'key': 'createOption', 'type': 'str'}, + 'diff_disk_settings': {'key': 'diffDiskSettings', 'type': 'DiffDiskSettings'}, + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, + 'os_type': {'key': 'osType', 'type': 'str'}, + 'image': {'key': 'image', 'type': 'VirtualHardDisk'}, + 'vhd_containers': {'key': 'vhdContainers', 'type': '[str]'}, + 'managed_disk': {'key': 'managedDisk', 'type': 'VirtualMachineScaleSetManagedDiskParameters'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetOSDisk, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.caching = kwargs.get('caching', None) + self.write_accelerator_enabled = kwargs.get('write_accelerator_enabled', None) + self.create_option = kwargs['create_option'] + self.diff_disk_settings = kwargs.get('diff_disk_settings', None) + self.disk_size_gb = kwargs.get('disk_size_gb', None) + self.os_type = kwargs.get('os_type', None) + self.image = kwargs.get('image', None) + self.vhd_containers = kwargs.get('vhd_containers', None) + self.managed_disk = kwargs.get('managed_disk', None) + + +class VirtualMachineScaleSetOSProfile(msrest.serialization.Model): + """Describes a virtual machine scale set OS profile. + + :param computer_name_prefix: Specifies the computer name prefix for all of the virtual machines + in the scale set. Computer name prefixes must be 1 to 15 characters long. + :type computer_name_prefix: str + :param admin_username: Specifies the name of the administrator account. + :code:`
    `:code:`
    ` **Windows-only restriction:** Cannot end in "." + :code:`
    `:code:`
    ` **Disallowed values:** "administrator", "admin", "user", "user1", + "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", + "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", + "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". + :code:`
    `:code:`
    ` **Minimum-length (Linux):** 1 character :code:`
    `:code:`
    ` + **Max-length (Linux):** 64 characters :code:`
    `:code:`
    ` **Max-length (Windows):** 20 + characters :code:`
    `:code:`
    `:code:`
  • ` For root access to the Linux VM, see `Using + root privileges on Linux virtual machines in Azure `_\ :code:`
    `:code:`
  • ` For a list of built-in system users on + Linux that should not be used in this field, see `Selecting User Names for Linux on Azure + `_. + :type admin_username: str + :param admin_password: Specifies the password of the administrator account. + :code:`
    `:code:`
    ` **Minimum-length (Windows):** 8 characters :code:`
    `:code:`
    ` + **Minimum-length (Linux):** 6 characters :code:`
    `:code:`
    ` **Max-length (Windows):** 123 + characters :code:`
    `:code:`
    ` **Max-length (Linux):** 72 characters + :code:`
    `:code:`
    ` **Complexity requirements:** 3 out of 4 conditions below need to be + fulfilled :code:`
    ` Has lower characters :code:`
    `Has upper characters :code:`
    ` Has a + digit :code:`
    ` Has a special character (Regex match [\W_]) :code:`
    `:code:`
    ` + **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", + "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" :code:`
    `:code:`
    ` For + resetting the password, see `How to reset the Remote Desktop service or its login password in a + Windows VM `_ :code:`
    `:code:`
    ` For + resetting root password, see `Manage users, SSH, and check or repair disks on Azure Linux VMs + using the VMAccess Extension `_. + :type admin_password: str + :param custom_data: Specifies a base-64 encoded string of custom data. The base-64 encoded + string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum + length of the binary array is 65535 bytes. :code:`
    `:code:`
    ` For using cloud-init for + your VM, see `Using cloud-init to customize a Linux VM during creation + `_. + :type custom_data: str + :param windows_configuration: Specifies Windows operating system settings on the virtual + machine. + :type windows_configuration: ~azure.mgmt.compute.v2021_03_01.models.WindowsConfiguration + :param linux_configuration: Specifies the Linux operating system settings on the virtual + machine. :code:`
    `:code:`
    `For a list of supported Linux distributions, see `Linux on + Azure-Endorsed Distributions `_ + :code:`
    `:code:`
    ` For running non-endorsed distributions, see `Information for Non- + Endorsed Distributions `_. + :type linux_configuration: ~azure.mgmt.compute.v2021_03_01.models.LinuxConfiguration + :param secrets: Specifies set of certificates that should be installed onto the virtual + machines in the scale set. + :type secrets: list[~azure.mgmt.compute.v2021_03_01.models.VaultSecretGroup] + """ + + _attribute_map = { + 'computer_name_prefix': {'key': 'computerNamePrefix', 'type': 'str'}, + 'admin_username': {'key': 'adminUsername', 'type': 'str'}, + 'admin_password': {'key': 'adminPassword', 'type': 'str'}, + 'custom_data': {'key': 'customData', 'type': 'str'}, + 'windows_configuration': {'key': 'windowsConfiguration', 'type': 'WindowsConfiguration'}, + 'linux_configuration': {'key': 'linuxConfiguration', 'type': 'LinuxConfiguration'}, + 'secrets': {'key': 'secrets', 'type': '[VaultSecretGroup]'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetOSProfile, self).__init__(**kwargs) + self.computer_name_prefix = kwargs.get('computer_name_prefix', None) + self.admin_username = kwargs.get('admin_username', None) + self.admin_password = kwargs.get('admin_password', None) + self.custom_data = kwargs.get('custom_data', None) + self.windows_configuration = kwargs.get('windows_configuration', None) + self.linux_configuration = kwargs.get('linux_configuration', None) + self.secrets = kwargs.get('secrets', None) + + +class VirtualMachineScaleSetPublicIPAddressConfiguration(msrest.serialization.Model): + """Describes a virtual machines scale set IP Configuration's PublicIPAddress configuration. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The publicIP address configuration name. + :type name: str + :param idle_timeout_in_minutes: The idle timeout of the public IP address. + :type idle_timeout_in_minutes: int + :param dns_settings: The dns settings to be applied on the publicIP addresses . + :type dns_settings: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + :param ip_tags: The list of IP tags associated with the public IP address. + :type ip_tags: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetIpTag] + :param public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. + :type public_ip_prefix: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param public_ip_address_version: Available from Api-Version 2019-07-01 onwards, it represents + whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values + are: 'IPv4' and 'IPv6'. Possible values include: "IPv4", "IPv6". + :type public_ip_address_version: str or ~azure.mgmt.compute.v2021_03_01.models.IPVersion + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'idle_timeout_in_minutes': {'key': 'properties.idleTimeoutInMinutes', 'type': 'int'}, + 'dns_settings': {'key': 'properties.dnsSettings', 'type': 'VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings'}, + 'ip_tags': {'key': 'properties.ipTags', 'type': '[VirtualMachineScaleSetIpTag]'}, + 'public_ip_prefix': {'key': 'properties.publicIPPrefix', 'type': 'SubResource'}, + 'public_ip_address_version': {'key': 'properties.publicIPAddressVersion', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetPublicIPAddressConfiguration, self).__init__(**kwargs) + self.name = kwargs['name'] + self.idle_timeout_in_minutes = kwargs.get('idle_timeout_in_minutes', None) + self.dns_settings = kwargs.get('dns_settings', None) + self.ip_tags = kwargs.get('ip_tags', None) + self.public_ip_prefix = kwargs.get('public_ip_prefix', None) + self.public_ip_address_version = kwargs.get('public_ip_address_version', None) + + +class VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings(msrest.serialization.Model): + """Describes a virtual machines scale sets network configuration's DNS settings. + + All required parameters must be populated in order to send to Azure. + + :param domain_name_label: Required. The Domain name label.The concatenation of the domain name + label and vm index will be the domain name labels of the PublicIPAddress resources that will be + created. + :type domain_name_label: str + """ + + _validation = { + 'domain_name_label': {'required': True}, + } + + _attribute_map = { + 'domain_name_label': {'key': 'domainNameLabel', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings, self).__init__(**kwargs) + self.domain_name_label = kwargs['domain_name_label'] + + +class VirtualMachineScaleSetVMReimageParameters(VirtualMachineReimageParameters): + """Describes a Virtual Machine Scale Set VM Reimage Parameters. + + :param temp_disk: Specifies whether to reimage temp disk. Default value: false. Note: This temp + disk reimage parameter is only supported for VM/VMSS with Ephemeral OS disk. + :type temp_disk: bool + """ + + _attribute_map = { + 'temp_disk': {'key': 'tempDisk', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetVMReimageParameters, self).__init__(**kwargs) + + +class VirtualMachineScaleSetReimageParameters(VirtualMachineScaleSetVMReimageParameters): + """Describes a Virtual Machine Scale Set VM Reimage Parameters. + + :param temp_disk: Specifies whether to reimage temp disk. Default value: false. Note: This temp + disk reimage parameter is only supported for VM/VMSS with Ephemeral OS disk. + :type temp_disk: bool + :param instance_ids: The virtual machine scale set instance ids. Omitting the virtual machine + scale set instance ids will result in the operation being performed on all virtual machines in + the virtual machine scale set. + :type instance_ids: list[str] + """ + + _attribute_map = { + 'temp_disk': {'key': 'tempDisk', 'type': 'bool'}, + 'instance_ids': {'key': 'instanceIds', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetReimageParameters, self).__init__(**kwargs) + self.instance_ids = kwargs.get('instance_ids', None) + + +class VirtualMachineScaleSetSku(msrest.serialization.Model): + """Describes an available virtual machine scale set sku. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar resource_type: The type of resource the sku applies to. + :vartype resource_type: str + :ivar sku: The Sku. + :vartype sku: ~azure.mgmt.compute.v2021_03_01.models.Sku + :ivar capacity: Specifies the number of virtual machines in the scale set. + :vartype capacity: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetSkuCapacity + """ + + _validation = { + 'resource_type': {'readonly': True}, + 'sku': {'readonly': True}, + 'capacity': {'readonly': True}, + } + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'capacity': {'key': 'capacity', 'type': 'VirtualMachineScaleSetSkuCapacity'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetSku, self).__init__(**kwargs) + self.resource_type = None + self.sku = None + self.capacity = None + + +class VirtualMachineScaleSetSkuCapacity(msrest.serialization.Model): + """Describes scaling information of a sku. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar minimum: The minimum capacity. + :vartype minimum: long + :ivar maximum: The maximum capacity that can be set. + :vartype maximum: long + :ivar default_capacity: The default capacity. + :vartype default_capacity: long + :ivar scale_type: The scale type applicable to the sku. Possible values include: "Automatic", + "None". + :vartype scale_type: str or + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetSkuScaleType + """ + + _validation = { + 'minimum': {'readonly': True}, + 'maximum': {'readonly': True}, + 'default_capacity': {'readonly': True}, + 'scale_type': {'readonly': True}, + } + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'long'}, + 'maximum': {'key': 'maximum', 'type': 'long'}, + 'default_capacity': {'key': 'defaultCapacity', 'type': 'long'}, + 'scale_type': {'key': 'scaleType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetSkuCapacity, self).__init__(**kwargs) + self.minimum = None + self.maximum = None + self.default_capacity = None + self.scale_type = None + + +class VirtualMachineScaleSetStorageProfile(msrest.serialization.Model): + """Describes a virtual machine scale set storage profile. + + :param image_reference: Specifies information about the image to use. You can specify + information about platform images, marketplace images, or virtual machine images. This element + is required when you want to use a platform image, marketplace image, or virtual machine image, + but is not used in other creation operations. + :type image_reference: ~azure.mgmt.compute.v2021_03_01.models.ImageReference + :param os_disk: Specifies information about the operating system disk used by the virtual + machines in the scale set. :code:`
    `:code:`
    ` For more information about disks, see + `About disks and VHDs for Azure virtual machines `_. + :type os_disk: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetOSDisk + :param data_disks: Specifies the parameters that are used to add data disks to the virtual + machines in the scale set. :code:`
    `:code:`
    ` For more information about disks, see + `About disks and VHDs for Azure virtual machines `_. + :type data_disks: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetDataDisk] + """ + + _attribute_map = { + 'image_reference': {'key': 'imageReference', 'type': 'ImageReference'}, + 'os_disk': {'key': 'osDisk', 'type': 'VirtualMachineScaleSetOSDisk'}, + 'data_disks': {'key': 'dataDisks', 'type': '[VirtualMachineScaleSetDataDisk]'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetStorageProfile, self).__init__(**kwargs) + self.image_reference = kwargs.get('image_reference', None) + self.os_disk = kwargs.get('os_disk', None) + self.data_disks = kwargs.get('data_disks', None) + + +class VirtualMachineScaleSetUpdate(UpdateResource): + """Describes a Virtual Machine Scale Set. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: The virtual machine scale set sku. + :type sku: ~azure.mgmt.compute.v2021_03_01.models.Sku + :param plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace + images. + :type plan: ~azure.mgmt.compute.v2021_03_01.models.Plan + :param identity: The identity of the virtual machine scale set, if configured. + :type identity: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetIdentity + :param upgrade_policy: The upgrade policy. + :type upgrade_policy: ~azure.mgmt.compute.v2021_03_01.models.UpgradePolicy + :param automatic_repairs_policy: Policy for automatic repairs. + :type automatic_repairs_policy: ~azure.mgmt.compute.v2021_03_01.models.AutomaticRepairsPolicy + :param virtual_machine_profile: The virtual machine profile. + :type virtual_machine_profile: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetUpdateVMProfile + :param overprovision: Specifies whether the Virtual Machine Scale Set should be + overprovisioned. + :type overprovision: bool + :param do_not_run_extensions_on_overprovisioned_v_ms: When Overprovision is enabled, extensions + are launched only on the requested number of VMs which are finally kept. This property will + hence ensure that the extensions do not run on the extra overprovisioned VMs. + :type do_not_run_extensions_on_overprovisioned_v_ms: bool + :param single_placement_group: When true this limits the scale set to a single placement group, + of max size 100 virtual machines. NOTE: If singlePlacementGroup is true, it may be modified to + false. However, if singlePlacementGroup is false, it may not be modified to true. + :type single_placement_group: bool + :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + Virtual Machines in the Virtual Machine Scale Set. For instance: whether the Virtual Machines + have the capability to support attaching managed data disks with UltraSSD_LRS storage account + type. + :type additional_capabilities: ~azure.mgmt.compute.v2021_03_01.models.AdditionalCapabilities + :param scale_in_policy: Specifies the scale-in policy that decides which virtual machines are + chosen for removal when a Virtual Machine Scale Set is scaled-in. + :type scale_in_policy: ~azure.mgmt.compute.v2021_03_01.models.ScaleInPolicy + :param proximity_placement_group: Specifies information about the proximity placement group + that the virtual machine scale set should be assigned to. :code:`
    `:code:`
    `Minimum api- + version: 2018-04-01. + :type proximity_placement_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'plan': {'key': 'plan', 'type': 'Plan'}, + 'identity': {'key': 'identity', 'type': 'VirtualMachineScaleSetIdentity'}, + 'upgrade_policy': {'key': 'properties.upgradePolicy', 'type': 'UpgradePolicy'}, + 'automatic_repairs_policy': {'key': 'properties.automaticRepairsPolicy', 'type': 'AutomaticRepairsPolicy'}, + 'virtual_machine_profile': {'key': 'properties.virtualMachineProfile', 'type': 'VirtualMachineScaleSetUpdateVMProfile'}, + 'overprovision': {'key': 'properties.overprovision', 'type': 'bool'}, + 'do_not_run_extensions_on_overprovisioned_v_ms': {'key': 'properties.doNotRunExtensionsOnOverprovisionedVMs', 'type': 'bool'}, + 'single_placement_group': {'key': 'properties.singlePlacementGroup', 'type': 'bool'}, + 'additional_capabilities': {'key': 'properties.additionalCapabilities', 'type': 'AdditionalCapabilities'}, + 'scale_in_policy': {'key': 'properties.scaleInPolicy', 'type': 'ScaleInPolicy'}, + 'proximity_placement_group': {'key': 'properties.proximityPlacementGroup', 'type': 'SubResource'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetUpdate, self).__init__(**kwargs) + self.sku = kwargs.get('sku', None) + self.plan = kwargs.get('plan', None) + self.identity = kwargs.get('identity', None) + self.upgrade_policy = kwargs.get('upgrade_policy', None) + self.automatic_repairs_policy = kwargs.get('automatic_repairs_policy', None) + self.virtual_machine_profile = kwargs.get('virtual_machine_profile', None) + self.overprovision = kwargs.get('overprovision', None) + self.do_not_run_extensions_on_overprovisioned_v_ms = kwargs.get('do_not_run_extensions_on_overprovisioned_v_ms', None) + self.single_placement_group = kwargs.get('single_placement_group', None) + self.additional_capabilities = kwargs.get('additional_capabilities', None) + self.scale_in_policy = kwargs.get('scale_in_policy', None) + self.proximity_placement_group = kwargs.get('proximity_placement_group', None) + + +class VirtualMachineScaleSetUpdateIPConfiguration(SubResource): + """Describes a virtual machine scale set network profile's IP configuration. NOTE: The subnet of a scale set may be modified as long as the original subnet and the new subnet are in the same virtual network. + + :param id: Resource Id. + :type id: str + :param name: The IP configuration name. + :type name: str + :param subnet: The subnet. + :type subnet: ~azure.mgmt.compute.v2021_03_01.models.ApiEntityReference + :param primary: Specifies the primary IP Configuration in case the network interface has more + than one IP Configuration. + :type primary: bool + :param public_ip_address_configuration: The publicIPAddressConfiguration. + :type public_ip_address_configuration: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration + :param private_ip_address_version: Available from Api-Version 2017-03-30 onwards, it represents + whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible + values are: 'IPv4' and 'IPv6'. Possible values include: "IPv4", "IPv6". + :type private_ip_address_version: str or ~azure.mgmt.compute.v2021_03_01.models.IPVersion + :param application_gateway_backend_address_pools: The application gateway backend address + pools. + :type application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + :param application_security_groups: Specifies an array of references to application security + group. + :type application_security_groups: list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + :param load_balancer_backend_address_pools: The load balancer backend address pools. + :type load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + :param load_balancer_inbound_nat_pools: The load balancer inbound nat pools. + :type load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'subnet': {'key': 'properties.subnet', 'type': 'ApiEntityReference'}, + 'primary': {'key': 'properties.primary', 'type': 'bool'}, + 'public_ip_address_configuration': {'key': 'properties.publicIPAddressConfiguration', 'type': 'VirtualMachineScaleSetUpdatePublicIPAddressConfiguration'}, + 'private_ip_address_version': {'key': 'properties.privateIPAddressVersion', 'type': 'str'}, + 'application_gateway_backend_address_pools': {'key': 'properties.applicationGatewayBackendAddressPools', 'type': '[SubResource]'}, + 'application_security_groups': {'key': 'properties.applicationSecurityGroups', 'type': '[SubResource]'}, + 'load_balancer_backend_address_pools': {'key': 'properties.loadBalancerBackendAddressPools', 'type': '[SubResource]'}, + 'load_balancer_inbound_nat_pools': {'key': 'properties.loadBalancerInboundNatPools', 'type': '[SubResource]'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetUpdateIPConfiguration, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.subnet = kwargs.get('subnet', None) + self.primary = kwargs.get('primary', None) + self.public_ip_address_configuration = kwargs.get('public_ip_address_configuration', None) + self.private_ip_address_version = kwargs.get('private_ip_address_version', None) + self.application_gateway_backend_address_pools = kwargs.get('application_gateway_backend_address_pools', None) + self.application_security_groups = kwargs.get('application_security_groups', None) + self.load_balancer_backend_address_pools = kwargs.get('load_balancer_backend_address_pools', None) + self.load_balancer_inbound_nat_pools = kwargs.get('load_balancer_inbound_nat_pools', None) + + +class VirtualMachineScaleSetUpdateNetworkConfiguration(SubResource): + """Describes a virtual machine scale set network profile's network configurations. + + :param id: Resource Id. + :type id: str + :param name: The network configuration name. + :type name: str + :param primary: Whether this is a primary NIC on a virtual machine. + :type primary: bool + :param enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :type enable_accelerated_networking: bool + :param enable_fpga: Specifies whether the network interface is FPGA networking-enabled. + :type enable_fpga: bool + :param network_security_group: The network security group. + :type network_security_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param dns_settings: The dns settings to be applied on the network interfaces. + :type dns_settings: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings + :param ip_configurations: The virtual machine scale set IP Configuration. + :type ip_configurations: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetUpdateIPConfiguration] + :param enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :type enable_ip_forwarding: bool + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'primary': {'key': 'properties.primary', 'type': 'bool'}, + 'enable_accelerated_networking': {'key': 'properties.enableAcceleratedNetworking', 'type': 'bool'}, + 'enable_fpga': {'key': 'properties.enableFpga', 'type': 'bool'}, + 'network_security_group': {'key': 'properties.networkSecurityGroup', 'type': 'SubResource'}, + 'dns_settings': {'key': 'properties.dnsSettings', 'type': 'VirtualMachineScaleSetNetworkConfigurationDnsSettings'}, + 'ip_configurations': {'key': 'properties.ipConfigurations', 'type': '[VirtualMachineScaleSetUpdateIPConfiguration]'}, + 'enable_ip_forwarding': {'key': 'properties.enableIPForwarding', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetUpdateNetworkConfiguration, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.primary = kwargs.get('primary', None) + self.enable_accelerated_networking = kwargs.get('enable_accelerated_networking', None) + self.enable_fpga = kwargs.get('enable_fpga', None) + self.network_security_group = kwargs.get('network_security_group', None) + self.dns_settings = kwargs.get('dns_settings', None) + self.ip_configurations = kwargs.get('ip_configurations', None) + self.enable_ip_forwarding = kwargs.get('enable_ip_forwarding', None) + + +class VirtualMachineScaleSetUpdateNetworkProfile(msrest.serialization.Model): + """Describes a virtual machine scale set network profile. + + :param health_probe: A reference to a load balancer probe used to determine the health of an + instance in the virtual machine scale set. The reference will be in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. + :type health_probe: ~azure.mgmt.compute.v2021_03_01.models.ApiEntityReference + :param network_interface_configurations: The list of network configurations. + :type network_interface_configurations: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetUpdateNetworkConfiguration] + """ + + _attribute_map = { + 'health_probe': {'key': 'healthProbe', 'type': 'ApiEntityReference'}, + 'network_interface_configurations': {'key': 'networkInterfaceConfigurations', 'type': '[VirtualMachineScaleSetUpdateNetworkConfiguration]'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetUpdateNetworkProfile, self).__init__(**kwargs) + self.health_probe = kwargs.get('health_probe', None) + self.network_interface_configurations = kwargs.get('network_interface_configurations', None) + + +class VirtualMachineScaleSetUpdateOSDisk(msrest.serialization.Model): + """Describes virtual machine scale set operating system disk Update Object. This should be used for Updating VMSS OS Disk. + + :param caching: The caching type. Possible values include: "None", "ReadOnly", "ReadWrite". + :type caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes + :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :type write_accelerator_enabled: bool + :param disk_size_gb: Specifies the size of the operating system disk in gigabytes. This element + can be used to overwrite the size of the disk in a virtual machine image. + :code:`
    `:code:`
    ` This value cannot be larger than 1023 GB. + :type disk_size_gb: int + :param image: The Source User Image VirtualHardDisk. This VirtualHardDisk will be copied before + using it to attach to the Virtual Machine. If SourceImage is provided, the destination + VirtualHardDisk should not exist. + :type image: ~azure.mgmt.compute.v2021_03_01.models.VirtualHardDisk + :param vhd_containers: The list of virtual hard disk container uris. + :type vhd_containers: list[str] + :param managed_disk: The managed disk parameters. + :type managed_disk: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetManagedDiskParameters + """ + + _attribute_map = { + 'caching': {'key': 'caching', 'type': 'str'}, + 'write_accelerator_enabled': {'key': 'writeAcceleratorEnabled', 'type': 'bool'}, + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, + 'image': {'key': 'image', 'type': 'VirtualHardDisk'}, + 'vhd_containers': {'key': 'vhdContainers', 'type': '[str]'}, + 'managed_disk': {'key': 'managedDisk', 'type': 'VirtualMachineScaleSetManagedDiskParameters'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetUpdateOSDisk, self).__init__(**kwargs) + self.caching = kwargs.get('caching', None) + self.write_accelerator_enabled = kwargs.get('write_accelerator_enabled', None) + self.disk_size_gb = kwargs.get('disk_size_gb', None) + self.image = kwargs.get('image', None) + self.vhd_containers = kwargs.get('vhd_containers', None) + self.managed_disk = kwargs.get('managed_disk', None) + + +class VirtualMachineScaleSetUpdateOSProfile(msrest.serialization.Model): + """Describes a virtual machine scale set OS profile. + + :param custom_data: A base-64 encoded string of custom data. + :type custom_data: str + :param windows_configuration: The Windows Configuration of the OS profile. + :type windows_configuration: ~azure.mgmt.compute.v2021_03_01.models.WindowsConfiguration + :param linux_configuration: The Linux Configuration of the OS profile. + :type linux_configuration: ~azure.mgmt.compute.v2021_03_01.models.LinuxConfiguration + :param secrets: The List of certificates for addition to the VM. + :type secrets: list[~azure.mgmt.compute.v2021_03_01.models.VaultSecretGroup] + """ + + _attribute_map = { + 'custom_data': {'key': 'customData', 'type': 'str'}, + 'windows_configuration': {'key': 'windowsConfiguration', 'type': 'WindowsConfiguration'}, + 'linux_configuration': {'key': 'linuxConfiguration', 'type': 'LinuxConfiguration'}, + 'secrets': {'key': 'secrets', 'type': '[VaultSecretGroup]'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetUpdateOSProfile, self).__init__(**kwargs) + self.custom_data = kwargs.get('custom_data', None) + self.windows_configuration = kwargs.get('windows_configuration', None) + self.linux_configuration = kwargs.get('linux_configuration', None) + self.secrets = kwargs.get('secrets', None) + + +class VirtualMachineScaleSetUpdatePublicIPAddressConfiguration(msrest.serialization.Model): + """Describes a virtual machines scale set IP Configuration's PublicIPAddress configuration. + + :param name: The publicIP address configuration name. + :type name: str + :param idle_timeout_in_minutes: The idle timeout of the public IP address. + :type idle_timeout_in_minutes: int + :param dns_settings: The dns settings to be applied on the publicIP addresses . + :type dns_settings: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'idle_timeout_in_minutes': {'key': 'properties.idleTimeoutInMinutes', 'type': 'int'}, + 'dns_settings': {'key': 'properties.dnsSettings', 'type': 'VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetUpdatePublicIPAddressConfiguration, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.idle_timeout_in_minutes = kwargs.get('idle_timeout_in_minutes', None) + self.dns_settings = kwargs.get('dns_settings', None) + + +class VirtualMachineScaleSetUpdateStorageProfile(msrest.serialization.Model): + """Describes a virtual machine scale set storage profile. + + :param image_reference: The image reference. + :type image_reference: ~azure.mgmt.compute.v2021_03_01.models.ImageReference + :param os_disk: The OS disk. + :type os_disk: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetUpdateOSDisk + :param data_disks: The data disks. + :type data_disks: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetDataDisk] + """ + + _attribute_map = { + 'image_reference': {'key': 'imageReference', 'type': 'ImageReference'}, + 'os_disk': {'key': 'osDisk', 'type': 'VirtualMachineScaleSetUpdateOSDisk'}, + 'data_disks': {'key': 'dataDisks', 'type': '[VirtualMachineScaleSetDataDisk]'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetUpdateStorageProfile, self).__init__(**kwargs) + self.image_reference = kwargs.get('image_reference', None) + self.os_disk = kwargs.get('os_disk', None) + self.data_disks = kwargs.get('data_disks', None) + + +class VirtualMachineScaleSetUpdateVMProfile(msrest.serialization.Model): + """Describes a virtual machine scale set virtual machine profile. + + :param os_profile: The virtual machine scale set OS profile. + :type os_profile: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetUpdateOSProfile + :param storage_profile: The virtual machine scale set storage profile. + :type storage_profile: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetUpdateStorageProfile + :param network_profile: The virtual machine scale set network profile. + :type network_profile: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetUpdateNetworkProfile + :param security_profile: The virtual machine scale set Security profile. + :type security_profile: ~azure.mgmt.compute.v2021_03_01.models.SecurityProfile + :param diagnostics_profile: The virtual machine scale set diagnostics profile. + :type diagnostics_profile: ~azure.mgmt.compute.v2021_03_01.models.DiagnosticsProfile + :param extension_profile: The virtual machine scale set extension profile. + :type extension_profile: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetExtensionProfile + :param license_type: The license type, which is for bring your own license scenario. + :type license_type: str + :param billing_profile: Specifies the billing related details of a Azure Spot VMSS. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :type billing_profile: ~azure.mgmt.compute.v2021_03_01.models.BillingProfile + :param scheduled_events_profile: Specifies Scheduled Event related configurations. + :type scheduled_events_profile: ~azure.mgmt.compute.v2021_03_01.models.ScheduledEventsProfile + :param user_data: UserData for the VM, which must be base-64 encoded. Customer should not pass + any secrets in here. :code:`
    `:code:`
    `Minimum api-version: 2021-03-01. + :type user_data: str + """ + + _attribute_map = { + 'os_profile': {'key': 'osProfile', 'type': 'VirtualMachineScaleSetUpdateOSProfile'}, + 'storage_profile': {'key': 'storageProfile', 'type': 'VirtualMachineScaleSetUpdateStorageProfile'}, + 'network_profile': {'key': 'networkProfile', 'type': 'VirtualMachineScaleSetUpdateNetworkProfile'}, + 'security_profile': {'key': 'securityProfile', 'type': 'SecurityProfile'}, + 'diagnostics_profile': {'key': 'diagnosticsProfile', 'type': 'DiagnosticsProfile'}, + 'extension_profile': {'key': 'extensionProfile', 'type': 'VirtualMachineScaleSetExtensionProfile'}, + 'license_type': {'key': 'licenseType', 'type': 'str'}, + 'billing_profile': {'key': 'billingProfile', 'type': 'BillingProfile'}, + 'scheduled_events_profile': {'key': 'scheduledEventsProfile', 'type': 'ScheduledEventsProfile'}, + 'user_data': {'key': 'userData', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetUpdateVMProfile, self).__init__(**kwargs) + self.os_profile = kwargs.get('os_profile', None) + self.storage_profile = kwargs.get('storage_profile', None) + self.network_profile = kwargs.get('network_profile', None) + self.security_profile = kwargs.get('security_profile', None) + self.diagnostics_profile = kwargs.get('diagnostics_profile', None) + self.extension_profile = kwargs.get('extension_profile', None) + self.license_type = kwargs.get('license_type', None) + self.billing_profile = kwargs.get('billing_profile', None) + self.scheduled_events_profile = kwargs.get('scheduled_events_profile', None) + self.user_data = kwargs.get('user_data', None) + + +class VirtualMachineScaleSetVM(Resource): + """Describes a virtual machine scale set 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 id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :ivar instance_id: The virtual machine instance ID. + :vartype instance_id: str + :ivar sku: The virtual machine SKU. + :vartype sku: ~azure.mgmt.compute.v2021_03_01.models.Sku + :param plan: Specifies information about the marketplace image used to create the virtual + machine. This element is only used for marketplace images. Before you can use a marketplace + image from an API, you must enable the image for programmatic use. In the Azure portal, find + the marketplace image that you want to use and then click **Want to deploy programmatically, + Get Started ->**. Enter any required information and then click **Save**. + :type plan: ~azure.mgmt.compute.v2021_03_01.models.Plan + :ivar resources: The virtual machine child extension resources. + :vartype resources: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtension] + :ivar zones: The virtual machine zones. + :vartype zones: list[str] + :ivar latest_model_applied: Specifies whether the latest model has been applied to the virtual + machine. + :vartype latest_model_applied: bool + :ivar vm_id: Azure VM unique ID. + :vartype vm_id: str + :ivar instance_view: The virtual machine instance view. + :vartype instance_view: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMInstanceView + :param hardware_profile: Specifies the hardware settings for the virtual machine. + :type hardware_profile: ~azure.mgmt.compute.v2021_03_01.models.HardwareProfile + :param storage_profile: Specifies the storage settings for the virtual machine disks. + :type storage_profile: ~azure.mgmt.compute.v2021_03_01.models.StorageProfile + :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + virtual machine in the scale set. For instance: whether the virtual machine has the capability + to support attaching managed data disks with UltraSSD_LRS storage account type. + :type additional_capabilities: ~azure.mgmt.compute.v2021_03_01.models.AdditionalCapabilities + :param os_profile: Specifies the operating system settings for the virtual machine. + :type os_profile: ~azure.mgmt.compute.v2021_03_01.models.OSProfile + :param security_profile: Specifies the Security related profile settings for the virtual + machine. + :type security_profile: ~azure.mgmt.compute.v2021_03_01.models.SecurityProfile + :param network_profile: Specifies the network interfaces of the virtual machine. + :type network_profile: ~azure.mgmt.compute.v2021_03_01.models.NetworkProfile + :param network_profile_configuration: Specifies the network profile configuration of the + virtual machine. + :type network_profile_configuration: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMNetworkProfileConfiguration + :param diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :type diagnostics_profile: ~azure.mgmt.compute.v2021_03_01.models.DiagnosticsProfile + :param availability_set: Specifies information about the availability set that the virtual + machine should be assigned to. Virtual machines specified in the same availability set are + allocated to different nodes to maximize availability. For more information about availability + sets, see `Manage the availability of virtual machines + `_. :code:`
    `:code:`
    ` + For more information on Azure planned maintenance, see `Planned maintenance for virtual + machines in Azure `_ + :code:`
    `:code:`
    ` Currently, a VM can only be added to availability set at creation + time. An existing VM cannot be added to an availability set. + :type availability_set: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :param license_type: Specifies that the image or disk that is being used was licensed on- + premises. :code:`
    `:code:`
    ` Possible values for Windows Server operating system are: + :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server + :code:`
    `:code:`
    ` Possible values for Linux Server operating system are: + :code:`
    `:code:`
    ` RHEL_BYOS (for RHEL) :code:`
    `:code:`
    ` SLES_BYOS (for SUSE) + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` `Azure Hybrid Use Benefit for Linux Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :type license_type: str + :ivar model_definition_applied: Specifies whether the model applied to the virtual machine is + the model of the virtual machine scale set or the customized model for the virtual machine. + :vartype model_definition_applied: str + :param protection_policy: Specifies the protection policy of the virtual machine. + :type protection_policy: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMProtectionPolicy + :param user_data: UserData for the VM, which must be base-64 encoded. Customer should not pass + any secrets in here. :code:`
    `:code:`
    `Minimum api-version: 2021-03-01. + :type user_data: str """ _validation = { - 'family': {'readonly': True}, - 'family_label': {'readonly': True}, - 'version': {'readonly': True}, - 'label': {'readonly': True}, - 'is_default': {'readonly': True}, - 'is_active': {'readonly': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'instance_id': {'readonly': True}, + 'sku': {'readonly': True}, + 'resources': {'readonly': True}, + 'zones': {'readonly': True}, + 'latest_model_applied': {'readonly': True}, + 'vm_id': {'readonly': True}, + 'instance_view': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'model_definition_applied': {'readonly': True}, } _attribute_map = { - 'family': {'key': 'family', 'type': 'str'}, - 'family_label': {'key': 'familyLabel', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'is_default': {'key': 'isDefault', 'type': 'bool'}, - 'is_active': {'key': 'isActive', 'type': 'bool'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'instance_id': {'key': 'instanceId', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'plan': {'key': 'plan', 'type': 'Plan'}, + 'resources': {'key': 'resources', 'type': '[VirtualMachineExtension]'}, + 'zones': {'key': 'zones', 'type': '[str]'}, + 'latest_model_applied': {'key': 'properties.latestModelApplied', 'type': 'bool'}, + 'vm_id': {'key': 'properties.vmId', 'type': 'str'}, + 'instance_view': {'key': 'properties.instanceView', 'type': 'VirtualMachineScaleSetVMInstanceView'}, + 'hardware_profile': {'key': 'properties.hardwareProfile', 'type': 'HardwareProfile'}, + 'storage_profile': {'key': 'properties.storageProfile', 'type': 'StorageProfile'}, + 'additional_capabilities': {'key': 'properties.additionalCapabilities', 'type': 'AdditionalCapabilities'}, + 'os_profile': {'key': 'properties.osProfile', 'type': 'OSProfile'}, + 'security_profile': {'key': 'properties.securityProfile', 'type': 'SecurityProfile'}, + 'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'}, + 'network_profile_configuration': {'key': 'properties.networkProfileConfiguration', 'type': 'VirtualMachineScaleSetVMNetworkProfileConfiguration'}, + 'diagnostics_profile': {'key': 'properties.diagnosticsProfile', 'type': 'DiagnosticsProfile'}, + 'availability_set': {'key': 'properties.availabilitySet', 'type': 'SubResource'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'license_type': {'key': 'properties.licenseType', 'type': 'str'}, + 'model_definition_applied': {'key': 'properties.modelDefinitionApplied', 'type': 'str'}, + 'protection_policy': {'key': 'properties.protectionPolicy', 'type': 'VirtualMachineScaleSetVMProtectionPolicy'}, + 'user_data': {'key': 'properties.userData', 'type': 'str'}, } def __init__( self, **kwargs ): - super(OSVersionProperties, self).__init__(**kwargs) - self.family = None - self.family_label = None - self.version = None - self.label = None - self.is_default = None - self.is_active = None + super(VirtualMachineScaleSetVM, self).__init__(**kwargs) + self.instance_id = None + self.sku = None + self.plan = kwargs.get('plan', None) + self.resources = None + self.zones = None + self.latest_model_applied = None + self.vm_id = None + self.instance_view = None + self.hardware_profile = kwargs.get('hardware_profile', None) + self.storage_profile = kwargs.get('storage_profile', None) + self.additional_capabilities = kwargs.get('additional_capabilities', None) + self.os_profile = kwargs.get('os_profile', None) + self.security_profile = kwargs.get('security_profile', None) + self.network_profile = kwargs.get('network_profile', None) + self.network_profile_configuration = kwargs.get('network_profile_configuration', None) + self.diagnostics_profile = kwargs.get('diagnostics_profile', None) + self.availability_set = kwargs.get('availability_set', None) + self.provisioning_state = None + self.license_type = kwargs.get('license_type', None) + self.model_definition_applied = None + self.protection_policy = kwargs.get('protection_policy', None) + self.user_data = kwargs.get('user_data', None) -class OSVersionPropertiesBase(msrest.serialization.Model): - """Configuration view of an OS version. +class VirtualMachineScaleSetVMExtension(SubResourceReadOnly): + """Describes a VMSS VM Extension. Variables are only populated by the server, and will be ignored when sending a request. - :ivar version: The OS version. - :vartype version: str - :ivar label: The OS version label. - :vartype label: str - :ivar is_default: Specifies whether this is the default OS version for its family. - :vartype is_default: bool - :ivar is_active: Specifies whether this OS version is active. - :vartype is_active: bool + :ivar id: Resource Id. + :vartype id: str + :ivar name: The name of the extension. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :type force_update_tag: str + :param publisher: The name of the extension handler publisher. + :type publisher: str + :param type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :type type_properties_type: str + :param type_handler_version: Specifies the version of the script handler. + :type type_handler_version: str + :param 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. + :type auto_upgrade_minor_version: bool + :param enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :type enable_automatic_upgrade: bool + :param settings: Json formatted public settings for the extension. + :type settings: object + :param protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :type protected_settings: object + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :param instance_view: The virtual machine extension instance view. + :type instance_view: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtensionInstanceView """ _validation = { - 'version': {'readonly': True}, - 'label': {'readonly': True}, - 'is_default': {'readonly': True}, - 'is_active': {'readonly': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, } _attribute_map = { - 'version': {'key': 'version', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'is_default': {'key': 'isDefault', 'type': 'bool'}, - 'is_active': {'key': 'isActive', 'type': 'bool'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', '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'}, + 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, + 'enable_automatic_upgrade': {'key': 'properties.enableAutomaticUpgrade', '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': 'VirtualMachineExtensionInstanceView'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetVMExtension, self).__init__(**kwargs) + self.name = None + self.type = None + self.force_update_tag = kwargs.get('force_update_tag', None) + self.publisher = kwargs.get('publisher', None) + self.type_properties_type = kwargs.get('type_properties_type', None) + self.type_handler_version = kwargs.get('type_handler_version', None) + self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', None) + self.enable_automatic_upgrade = kwargs.get('enable_automatic_upgrade', None) + self.settings = kwargs.get('settings', None) + self.protected_settings = kwargs.get('protected_settings', None) + self.provisioning_state = None + self.instance_view = kwargs.get('instance_view', None) + + +class VirtualMachineScaleSetVMExtensionsListResult(msrest.serialization.Model): + """The List VMSS VM Extension operation response. + + :param value: The list of VMSS VM extensions. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMExtension] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VirtualMachineScaleSetVMExtension]'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetVMExtensionsListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class VirtualMachineScaleSetVMExtensionsSummary(msrest.serialization.Model): + """Extensions summary for virtual machines of a virtual machine scale set. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The extension name. + :vartype name: str + :ivar statuses_summary: The extensions information. + :vartype statuses_summary: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineStatusCodeCount] + """ + + _validation = { + 'name': {'readonly': True}, + 'statuses_summary': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'statuses_summary': {'key': 'statusesSummary', 'type': '[VirtualMachineStatusCodeCount]'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetVMExtensionsSummary, self).__init__(**kwargs) + self.name = None + self.statuses_summary = None + + +class VirtualMachineScaleSetVMExtensionUpdate(SubResourceReadOnly): + """Describes a VMSS VM Extension. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: The name of the extension. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :type force_update_tag: str + :param publisher: The name of the extension handler publisher. + :type publisher: str + :param type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :type type_properties_type: str + :param type_handler_version: Specifies the version of the script handler. + :type type_handler_version: str + :param 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. + :type auto_upgrade_minor_version: bool + :param enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :type enable_automatic_upgrade: bool + :param settings: Json formatted public settings for the extension. + :type settings: object + :param protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :type protected_settings: object + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + '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'}, + 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, + 'enable_automatic_upgrade': {'key': 'properties.enableAutomaticUpgrade', 'type': 'bool'}, + 'settings': {'key': 'properties.settings', 'type': 'object'}, + 'protected_settings': {'key': 'properties.protectedSettings', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetVMExtensionUpdate, self).__init__(**kwargs) + self.name = None + self.type = None + self.force_update_tag = kwargs.get('force_update_tag', None) + self.publisher = kwargs.get('publisher', None) + self.type_properties_type = kwargs.get('type_properties_type', None) + self.type_handler_version = kwargs.get('type_handler_version', None) + self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', None) + self.enable_automatic_upgrade = kwargs.get('enable_automatic_upgrade', None) + self.settings = kwargs.get('settings', None) + self.protected_settings = kwargs.get('protected_settings', None) + + +class VirtualMachineScaleSetVMInstanceIDs(msrest.serialization.Model): + """Specifies a list of virtual machine instance IDs from the VM scale set. + + :param instance_ids: The virtual machine scale set instance ids. Omitting the virtual machine + scale set instance ids will result in the operation being performed on all virtual machines in + the virtual machine scale set. + :type instance_ids: list[str] + """ + + _attribute_map = { + 'instance_ids': {'key': 'instanceIds', 'type': '[str]'}, } def __init__( self, **kwargs ): - super(OSVersionPropertiesBase, self).__init__(**kwargs) - self.version = None - self.label = None - self.is_default = None - self.is_active = None + super(VirtualMachineScaleSetVMInstanceIDs, self).__init__(**kwargs) + self.instance_ids = kwargs.get('instance_ids', None) -class ResourceInstanceViewStatus(msrest.serialization.Model): - """Instance view status. +class VirtualMachineScaleSetVMInstanceRequiredIDs(msrest.serialization.Model): + """Specifies a list of virtual machine instance IDs from the VM scale set. - 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 code: The status code. - :vartype code: str - :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 - :param level: The level code. Possible values include: "Info", "Warning", "Error". - :type level: str or ~azure.mgmt.compute.v2021_03_01.models.StatusLevelTypes + :param instance_ids: Required. The virtual machine scale set instance ids. + :type instance_ids: list[str] """ _validation = { - 'code': {'readonly': True}, - 'display_status': {'readonly': True}, - 'message': {'readonly': True}, - 'time': {'readonly': True}, + 'instance_ids': {'required': True}, } _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'display_status': {'key': 'displayStatus', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'time': {'key': 'time', 'type': 'iso-8601'}, - 'level': {'key': 'level', 'type': 'str'}, + 'instance_ids': {'key': 'instanceIds', 'type': '[str]'}, } def __init__( self, **kwargs ): - super(ResourceInstanceViewStatus, self).__init__(**kwargs) - self.code = None - self.display_status = None - self.message = None - self.time = None - self.level = kwargs.get('level', None) + super(VirtualMachineScaleSetVMInstanceRequiredIDs, self).__init__(**kwargs) + self.instance_ids = kwargs['instance_ids'] -class RoleInstance(msrest.serialization.Model): - """RoleInstance. +class VirtualMachineScaleSetVMInstanceView(msrest.serialization.Model): + """The instance view of a virtual machine scale set VM. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :ivar location: Resource Location. - :vartype location: str - :ivar tags: A set of tags. Resource tags. - :vartype tags: dict[str, str] - :param sku: - :type sku: ~azure.mgmt.compute.v2021_03_01.models.InstanceSku - :param properties: - :type properties: ~azure.mgmt.compute.v2021_03_01.models.RoleInstanceProperties + :param platform_update_domain: The Update Domain count. + :type platform_update_domain: int + :param platform_fault_domain: The Fault Domain count. + :type platform_fault_domain: int + :param rdp_thumb_print: The Remote desktop certificate thumbprint. + :type rdp_thumb_print: str + :param vm_agent: The VM Agent running on the virtual machine. + :type vm_agent: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineAgentInstanceView + :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :type maintenance_redeploy_status: + ~azure.mgmt.compute.v2021_03_01.models.MaintenanceRedeployStatus + :param disks: The disks information. + :type disks: list[~azure.mgmt.compute.v2021_03_01.models.DiskInstanceView] + :param extensions: The extensions information. + :type extensions: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtensionInstanceView] + :ivar vm_health: The health status for the VM. + :vartype vm_health: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineHealthStatus + :param boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + Console Output and Screenshot to diagnose VM status. :code:`
    `:code:`
    ` You can easily + view the output of your console log. :code:`
    `:code:`
    ` Azure also enables you to see a + screenshot of the VM from the hypervisor. + :type boot_diagnostics: ~azure.mgmt.compute.v2021_03_01.models.BootDiagnosticsInstanceView + :param statuses: The resource status information. + :type statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + :ivar assigned_host: Resource id of the dedicated host, on which the virtual machine is + allocated through automatic placement, when the virtual machine is associated with a dedicated + host group that has automatic placement enabled. :code:`
    `:code:`
    `Minimum api-version: + 2020-06-01. + :vartype assigned_host: str + :param placement_group_id: The placement group in which the VM is running. If the VM is + deallocated it will not have a placementGroupId. + :type placement_group_id: str """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'tags': {'readonly': True}, + 'vm_health': {'readonly': True}, + 'assigned_host': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'InstanceSku'}, - 'properties': {'key': 'properties', 'type': 'RoleInstanceProperties'}, + 'platform_update_domain': {'key': 'platformUpdateDomain', 'type': 'int'}, + 'platform_fault_domain': {'key': 'platformFaultDomain', 'type': 'int'}, + 'rdp_thumb_print': {'key': 'rdpThumbPrint', 'type': 'str'}, + 'vm_agent': {'key': 'vmAgent', 'type': 'VirtualMachineAgentInstanceView'}, + 'maintenance_redeploy_status': {'key': 'maintenanceRedeployStatus', 'type': 'MaintenanceRedeployStatus'}, + 'disks': {'key': 'disks', 'type': '[DiskInstanceView]'}, + 'extensions': {'key': 'extensions', 'type': '[VirtualMachineExtensionInstanceView]'}, + 'vm_health': {'key': 'vmHealth', 'type': 'VirtualMachineHealthStatus'}, + 'boot_diagnostics': {'key': 'bootDiagnostics', 'type': 'BootDiagnosticsInstanceView'}, + 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, + 'assigned_host': {'key': 'assignedHost', 'type': 'str'}, + 'placement_group_id': {'key': 'placementGroupId', 'type': 'str'}, } def __init__( self, **kwargs ): - super(RoleInstance, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = None - self.tags = None - self.sku = kwargs.get('sku', None) - self.properties = kwargs.get('properties', None) + super(VirtualMachineScaleSetVMInstanceView, self).__init__(**kwargs) + self.platform_update_domain = kwargs.get('platform_update_domain', None) + self.platform_fault_domain = kwargs.get('platform_fault_domain', None) + self.rdp_thumb_print = kwargs.get('rdp_thumb_print', None) + self.vm_agent = kwargs.get('vm_agent', None) + self.maintenance_redeploy_status = kwargs.get('maintenance_redeploy_status', None) + self.disks = kwargs.get('disks', None) + self.extensions = kwargs.get('extensions', None) + self.vm_health = None + self.boot_diagnostics = kwargs.get('boot_diagnostics', None) + self.statuses = kwargs.get('statuses', None) + self.assigned_host = None + self.placement_group_id = kwargs.get('placement_group_id', None) -class RoleInstanceListResult(msrest.serialization.Model): - """RoleInstanceListResult. +class VirtualMachineScaleSetVMListResult(msrest.serialization.Model): + """The List Virtual Machine Scale Set VMs operation response. All required parameters must be populated in order to send to Azure. - :param value: Required. - :type value: list[~azure.mgmt.compute.v2021_03_01.models.RoleInstance] - :param next_link: + :param value: Required. The list of virtual machine scale sets VMs. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVM] + :param next_link: The uri to fetch the next page of Virtual Machine Scale Set VMs. Call + ListNext() with this to fetch the next page of VMSS VMs. :type next_link: str """ @@ -1297,7 +9658,7 @@ class RoleInstanceListResult(msrest.serialization.Model): } _attribute_map = { - 'value': {'key': 'value', 'type': '[RoleInstance]'}, + 'value': {'key': 'value', 'type': '[VirtualMachineScaleSetVM]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } @@ -1305,136 +9666,289 @@ def __init__( self, **kwargs ): - super(RoleInstanceListResult, self).__init__(**kwargs) + super(VirtualMachineScaleSetVMListResult, self).__init__(**kwargs) self.value = kwargs['value'] self.next_link = kwargs.get('next_link', None) -class RoleInstanceNetworkProfile(msrest.serialization.Model): - """Describes the network profile for the role instance. +class VirtualMachineScaleSetVMNetworkProfileConfiguration(msrest.serialization.Model): + """Describes a virtual machine scale set VM network profile. - Variables are only populated by the server, and will be ignored when sending a request. + :param network_interface_configurations: The list of network configurations. + :type network_interface_configurations: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetNetworkConfiguration] + """ - :ivar network_interfaces: Specifies the list of resource Ids for the network interfaces - associated with the role instance. - :vartype network_interfaces: list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + _attribute_map = { + 'network_interface_configurations': {'key': 'networkInterfaceConfigurations', 'type': '[VirtualMachineScaleSetNetworkConfiguration]'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetVMNetworkProfileConfiguration, self).__init__(**kwargs) + self.network_interface_configurations = kwargs.get('network_interface_configurations', None) + + +class VirtualMachineScaleSetVMProfile(msrest.serialization.Model): + """Describes a virtual machine scale set virtual machine profile. + + :param os_profile: Specifies the operating system settings for the virtual machines in the + scale set. + :type os_profile: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetOSProfile + :param storage_profile: Specifies the storage settings for the virtual machine disks. + :type storage_profile: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetStorageProfile + :param network_profile: Specifies properties of the network interfaces of the virtual machines + in the scale set. + :type network_profile: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetNetworkProfile + :param security_profile: Specifies the Security related profile settings for the virtual + machines in the scale set. + :type security_profile: ~azure.mgmt.compute.v2021_03_01.models.SecurityProfile + :param diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :type diagnostics_profile: ~azure.mgmt.compute.v2021_03_01.models.DiagnosticsProfile + :param extension_profile: Specifies a collection of settings for extensions installed on + virtual machines in the scale set. + :type extension_profile: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetExtensionProfile + :param license_type: Specifies that the image or disk that is being used was licensed on- + premises. :code:`
    `:code:`
    ` Possible values for Windows Server operating system are: + :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server + :code:`
    `:code:`
    ` Possible values for Linux Server operating system are: + :code:`
    `:code:`
    ` RHEL_BYOS (for RHEL) :code:`
    `:code:`
    ` SLES_BYOS (for SUSE) + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` `Azure Hybrid Use Benefit for Linux Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :type license_type: str + :param priority: Specifies the priority for the virtual machines in the scale set. + :code:`
    `:code:`
    `Minimum api-version: 2017-10-30-preview. Possible values include: + "Regular", "Low", "Spot". + :type priority: str or ~azure.mgmt.compute.v2021_03_01.models.VirtualMachinePriorityTypes + :param eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and + Azure Spot scale set. :code:`
    `:code:`
    `For Azure Spot virtual machines, both + 'Deallocate' and 'Delete' are supported and the minimum api-version is 2019-03-01. + :code:`
    `:code:`
    `For Azure Spot scale sets, both 'Deallocate' and 'Delete' are supported + and the minimum api-version is 2017-10-30-preview. Possible values include: "Deallocate", + "Delete". + :type eviction_policy: str or + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineEvictionPolicyTypes + :param billing_profile: Specifies the billing related details of a Azure Spot VMSS. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :type billing_profile: ~azure.mgmt.compute.v2021_03_01.models.BillingProfile + :param scheduled_events_profile: Specifies Scheduled Event related configurations. + :type scheduled_events_profile: ~azure.mgmt.compute.v2021_03_01.models.ScheduledEventsProfile + :param user_data: UserData for the VMSS, which must be base-64 encoded. Customer should not + pass any secrets in here. :code:`
    `:code:`
    `Minimum api-version: 2021-03-01. + :type user_data: str """ - _validation = { - 'network_interfaces': {'readonly': True}, + _attribute_map = { + 'os_profile': {'key': 'osProfile', 'type': 'VirtualMachineScaleSetOSProfile'}, + 'storage_profile': {'key': 'storageProfile', 'type': 'VirtualMachineScaleSetStorageProfile'}, + 'network_profile': {'key': 'networkProfile', 'type': 'VirtualMachineScaleSetNetworkProfile'}, + 'security_profile': {'key': 'securityProfile', 'type': 'SecurityProfile'}, + 'diagnostics_profile': {'key': 'diagnosticsProfile', 'type': 'DiagnosticsProfile'}, + 'extension_profile': {'key': 'extensionProfile', 'type': 'VirtualMachineScaleSetExtensionProfile'}, + 'license_type': {'key': 'licenseType', 'type': 'str'}, + 'priority': {'key': 'priority', 'type': 'str'}, + 'eviction_policy': {'key': 'evictionPolicy', 'type': 'str'}, + 'billing_profile': {'key': 'billingProfile', 'type': 'BillingProfile'}, + 'scheduled_events_profile': {'key': 'scheduledEventsProfile', 'type': 'ScheduledEventsProfile'}, + 'user_data': {'key': 'userData', 'type': 'str'}, } + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetVMProfile, self).__init__(**kwargs) + self.os_profile = kwargs.get('os_profile', None) + self.storage_profile = kwargs.get('storage_profile', None) + self.network_profile = kwargs.get('network_profile', None) + self.security_profile = kwargs.get('security_profile', None) + self.diagnostics_profile = kwargs.get('diagnostics_profile', None) + self.extension_profile = kwargs.get('extension_profile', None) + self.license_type = kwargs.get('license_type', None) + self.priority = kwargs.get('priority', None) + self.eviction_policy = kwargs.get('eviction_policy', None) + self.billing_profile = kwargs.get('billing_profile', None) + self.scheduled_events_profile = kwargs.get('scheduled_events_profile', None) + self.user_data = kwargs.get('user_data', None) + + +class VirtualMachineScaleSetVMProtectionPolicy(msrest.serialization.Model): + """The protection policy of a virtual machine scale set VM. + + :param protect_from_scale_in: Indicates that the virtual machine scale set VM shouldn't be + considered for deletion during a scale-in operation. + :type protect_from_scale_in: bool + :param protect_from_scale_set_actions: Indicates that model updates or actions (including + scale-in) initiated on the virtual machine scale set should not be applied to the virtual + machine scale set VM. + :type protect_from_scale_set_actions: bool + """ + _attribute_map = { - 'network_interfaces': {'key': 'networkInterfaces', 'type': '[SubResource]'}, + 'protect_from_scale_in': {'key': 'protectFromScaleIn', 'type': 'bool'}, + 'protect_from_scale_set_actions': {'key': 'protectFromScaleSetActions', 'type': 'bool'}, } def __init__( self, **kwargs ): - super(RoleInstanceNetworkProfile, self).__init__(**kwargs) - self.network_interfaces = None + super(VirtualMachineScaleSetVMProtectionPolicy, self).__init__(**kwargs) + self.protect_from_scale_in = kwargs.get('protect_from_scale_in', None) + self.protect_from_scale_set_actions = kwargs.get('protect_from_scale_set_actions', None) -class RoleInstanceProperties(msrest.serialization.Model): - """RoleInstanceProperties. +class VirtualMachineSize(msrest.serialization.Model): + """Describes the properties of a VM size. - :param network_profile: Describes the network profile for the role instance. - :type network_profile: ~azure.mgmt.compute.v2021_03_01.models.RoleInstanceNetworkProfile - :param instance_view: The instance view of the role instance. - :type instance_view: ~azure.mgmt.compute.v2021_03_01.models.RoleInstanceView + :param name: The name of the virtual machine size. + :type name: str + :param number_of_cores: The number of cores supported by the virtual machine size. + :type number_of_cores: int + :param os_disk_size_in_mb: The OS disk size, in MB, allowed by the virtual machine size. + :type os_disk_size_in_mb: int + :param resource_disk_size_in_mb: The resource disk size, in MB, allowed by the virtual machine + size. + :type resource_disk_size_in_mb: int + :param memory_in_mb: The amount of memory, in MB, supported by the virtual machine size. + :type memory_in_mb: int + :param max_data_disk_count: The maximum number of data disks that can be attached to the + virtual machine size. + :type max_data_disk_count: int """ _attribute_map = { - 'network_profile': {'key': 'networkProfile', 'type': 'RoleInstanceNetworkProfile'}, - 'instance_view': {'key': 'instanceView', 'type': 'RoleInstanceView'}, + 'name': {'key': 'name', 'type': 'str'}, + 'number_of_cores': {'key': 'numberOfCores', 'type': 'int'}, + 'os_disk_size_in_mb': {'key': 'osDiskSizeInMB', 'type': 'int'}, + 'resource_disk_size_in_mb': {'key': 'resourceDiskSizeInMB', 'type': 'int'}, + 'memory_in_mb': {'key': 'memoryInMB', 'type': 'int'}, + 'max_data_disk_count': {'key': 'maxDataDiskCount', 'type': 'int'}, } def __init__( self, **kwargs ): - super(RoleInstanceProperties, self).__init__(**kwargs) - self.network_profile = kwargs.get('network_profile', None) - self.instance_view = kwargs.get('instance_view', None) - + super(VirtualMachineSize, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.number_of_cores = kwargs.get('number_of_cores', None) + self.os_disk_size_in_mb = kwargs.get('os_disk_size_in_mb', None) + self.resource_disk_size_in_mb = kwargs.get('resource_disk_size_in_mb', None) + self.memory_in_mb = kwargs.get('memory_in_mb', None) + self.max_data_disk_count = kwargs.get('max_data_disk_count', None) -class RoleInstances(msrest.serialization.Model): - """Specifies a list of role instances from the cloud service. - All required parameters must be populated in order to send to Azure. +class VirtualMachineSizeListResult(msrest.serialization.Model): + """The List Virtual Machine operation response. - :param role_instances: Required. List of cloud service role instance names. Value of '*' will - signify all role instances of the cloud service. - :type role_instances: list[str] + :param value: The list of virtual machine sizes. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineSize] """ - _validation = { - 'role_instances': {'required': True}, - } - _attribute_map = { - 'role_instances': {'key': 'roleInstances', 'type': '[str]'}, + 'value': {'key': 'value', 'type': '[VirtualMachineSize]'}, } def __init__( self, **kwargs ): - super(RoleInstances, self).__init__(**kwargs) - self.role_instances = kwargs['role_instances'] + super(VirtualMachineSizeListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) -class RoleInstanceView(msrest.serialization.Model): - """The instance view of the role instance. +class VirtualMachineSoftwarePatchProperties(msrest.serialization.Model): + """Describes the properties of a Virtual Machine software patch. Variables are only populated by the server, and will be ignored when sending a request. - :ivar platform_update_domain: The Update Domain. - :vartype platform_update_domain: int - :ivar platform_fault_domain: The Fault Domain. - :vartype platform_fault_domain: int - :ivar private_id: Specifies a unique identifier generated internally for the cloud service - associated with this role instance. :code:`
    `:code:`
    ` NOTE: If you are using Azure - Diagnostics extension, this property can be used as 'DeploymentId' for querying details. - :vartype private_id: str - :ivar statuses: - :vartype statuses: list[~azure.mgmt.compute.v2021_03_01.models.ResourceInstanceViewStatus] + :ivar patch_id: A unique identifier for the patch. + :vartype patch_id: str + :ivar name: The friendly name of the patch. + :vartype name: str + :ivar version: The version number of the patch. This property applies only to Linux patches. + :vartype version: str + :ivar kb_id: The KBID of the patch. Only applies to Windows patches. + :vartype kb_id: str + :ivar classifications: The classification(s) of the patch as provided by the patch publisher. + :vartype classifications: list[str] + :ivar reboot_behavior: Describes the reboot requirements of the patch. Possible values include: + "Unknown", "NeverReboots", "AlwaysRequiresReboot", "CanRequestReboot". + :vartype reboot_behavior: str or + ~azure.mgmt.compute.v2021_03_01.models.VMGuestPatchRebootBehavior + :ivar activity_id: The activity ID of the operation that produced this result. It is used to + correlate across CRP and extension logs. + :vartype activity_id: str + :ivar published_date: The UTC timestamp when the repository published this patch. + :vartype published_date: ~datetime.datetime + :ivar last_modified_date_time: The UTC timestamp of the last update to this patch record. + :vartype last_modified_date_time: ~datetime.datetime + :ivar assessment_state: Describes the availability of a given patch. Possible values include: + "Unknown", "Available". + :vartype assessment_state: str or ~azure.mgmt.compute.v2021_03_01.models.PatchAssessmentState """ _validation = { - 'platform_update_domain': {'readonly': True}, - 'platform_fault_domain': {'readonly': True}, - 'private_id': {'readonly': True}, - 'statuses': {'readonly': True}, + 'patch_id': {'readonly': True}, + 'name': {'readonly': True}, + 'version': {'readonly': True}, + 'kb_id': {'readonly': True}, + 'classifications': {'readonly': True}, + 'reboot_behavior': {'readonly': True}, + 'activity_id': {'readonly': True}, + 'published_date': {'readonly': True}, + 'last_modified_date_time': {'readonly': True}, + 'assessment_state': {'readonly': True}, } _attribute_map = { - 'platform_update_domain': {'key': 'platformUpdateDomain', 'type': 'int'}, - 'platform_fault_domain': {'key': 'platformFaultDomain', 'type': 'int'}, - 'private_id': {'key': 'privateId', 'type': 'str'}, - 'statuses': {'key': 'statuses', 'type': '[ResourceInstanceViewStatus]'}, + 'patch_id': {'key': 'patchId', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'kb_id': {'key': 'kbId', 'type': 'str'}, + 'classifications': {'key': 'classifications', 'type': '[str]'}, + 'reboot_behavior': {'key': 'rebootBehavior', 'type': 'str'}, + 'activity_id': {'key': 'activityId', 'type': 'str'}, + 'published_date': {'key': 'publishedDate', 'type': 'iso-8601'}, + 'last_modified_date_time': {'key': 'lastModifiedDateTime', 'type': 'iso-8601'}, + 'assessment_state': {'key': 'assessmentState', 'type': 'str'}, } def __init__( self, **kwargs ): - super(RoleInstanceView, self).__init__(**kwargs) - self.platform_update_domain = None - self.platform_fault_domain = None - self.private_id = None - self.statuses = None + super(VirtualMachineSoftwarePatchProperties, self).__init__(**kwargs) + self.patch_id = None + self.name = None + self.version = None + self.kb_id = None + self.classifications = None + self.reboot_behavior = None + self.activity_id = None + self.published_date = None + self.last_modified_date_time = None + self.assessment_state = None -class StatusCodeCount(msrest.serialization.Model): - """StatusCodeCount. +class VirtualMachineStatusCodeCount(msrest.serialization.Model): + """The status code and count of the virtual machine scale set instance view status summary. Variables are only populated by the server, and will be ignored when sending a request. :ivar code: The instance view status code. :vartype code: str - :ivar count: Number of instances having this status code. + :ivar count: The number of instances having a particular status code. :vartype count: int """ @@ -1452,84 +9966,357 @@ def __init__( self, **kwargs ): - super(StatusCodeCount, self).__init__(**kwargs) + super(VirtualMachineStatusCodeCount, self).__init__(**kwargs) self.code = None self.count = None -class SubResource(msrest.serialization.Model): - """SubResource. +class VirtualMachineUpdate(UpdateResource): + """Describes a Virtual Machine Update. - :param id: Resource Id. - :type id: str + Variables are only populated by the server, and will be ignored when sending a request. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param plan: Specifies information about the marketplace image used to create the virtual + machine. This element is only used for marketplace images. Before you can use a marketplace + image from an API, you must enable the image for programmatic use. In the Azure portal, find + the marketplace image that you want to use and then click **Want to deploy programmatically, + Get Started ->**. Enter any required information and then click **Save**. + :type plan: ~azure.mgmt.compute.v2021_03_01.models.Plan + :param identity: The identity of the virtual machine, if configured. + :type identity: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineIdentity + :param zones: The virtual machine zones. + :type zones: list[str] + :param hardware_profile: Specifies the hardware settings for the virtual machine. + :type hardware_profile: ~azure.mgmt.compute.v2021_03_01.models.HardwareProfile + :param storage_profile: Specifies the storage settings for the virtual machine disks. + :type storage_profile: ~azure.mgmt.compute.v2021_03_01.models.StorageProfile + :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + virtual machine. + :type additional_capabilities: ~azure.mgmt.compute.v2021_03_01.models.AdditionalCapabilities + :param os_profile: Specifies the operating system settings used while creating the virtual + machine. Some of the settings cannot be changed once VM is provisioned. + :type os_profile: ~azure.mgmt.compute.v2021_03_01.models.OSProfile + :param network_profile: Specifies the network interfaces of the virtual machine. + :type network_profile: ~azure.mgmt.compute.v2021_03_01.models.NetworkProfile + :param security_profile: Specifies the Security related profile settings for the virtual + machine. + :type security_profile: ~azure.mgmt.compute.v2021_03_01.models.SecurityProfile + :param diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :type diagnostics_profile: ~azure.mgmt.compute.v2021_03_01.models.DiagnosticsProfile + :param availability_set: Specifies information about the availability set that the virtual + machine should be assigned to. Virtual machines specified in the same availability set are + allocated to different nodes to maximize availability. For more information about availability + sets, see `Manage the availability of virtual machines + `_. :code:`
    `:code:`
    ` + For more information on Azure planned maintenance, see `Planned maintenance for virtual + machines in Azure `_ + :code:`
    `:code:`
    ` Currently, a VM can only be added to availability set at creation + time. The availability set to which the VM is being added should be under the same resource + group as the availability set resource. An existing VM cannot be added to an availability set. + :code:`
    `:code:`
    `This property cannot exist along with a non-null + properties.virtualMachineScaleSet reference. + :type availability_set: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param virtual_machine_scale_set: Specifies information about the virtual machine scale set + that the virtual machine should be assigned to. Virtual machines specified in the same virtual + machine scale set are allocated to different nodes to maximize availability. Currently, a VM + can only be added to virtual machine scale set at creation time. An existing VM cannot be added + to a virtual machine scale set. :code:`
    `:code:`
    `This property cannot exist along with a + non-null properties.availabilitySet reference. :code:`
    `:code:`
    `Minimum api‐version: + 2019‐03‐01. + :type virtual_machine_scale_set: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param proximity_placement_group: Specifies information about the proximity placement group + that the virtual machine should be assigned to. :code:`
    `:code:`
    `Minimum api-version: + 2018-04-01. + :type proximity_placement_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param priority: Specifies the priority for the virtual machine. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. Possible values include: "Regular", + "Low", "Spot". + :type priority: str or ~azure.mgmt.compute.v2021_03_01.models.VirtualMachinePriorityTypes + :param eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and + Azure Spot scale set. :code:`
    `:code:`
    `For Azure Spot virtual machines, both + 'Deallocate' and 'Delete' are supported and the minimum api-version is 2019-03-01. + :code:`
    `:code:`
    `For Azure Spot scale sets, both 'Deallocate' and 'Delete' are supported + and the minimum api-version is 2017-10-30-preview. Possible values include: "Deallocate", + "Delete". + :type eviction_policy: str or + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineEvictionPolicyTypes + :param billing_profile: Specifies the billing related details of a Azure Spot virtual machine. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :type billing_profile: ~azure.mgmt.compute.v2021_03_01.models.BillingProfile + :param host: Specifies information about the dedicated host that the virtual machine resides + in. :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :type host: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param host_group: Specifies information about the dedicated host group that the virtual + machine resides in. :code:`
    `:code:`
    `Minimum api-version: 2020-06-01. + :code:`
    `:code:`
    `NOTE: User cannot specify both host and hostGroup properties. + :type host_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :ivar instance_view: The virtual machine instance view. + :vartype instance_view: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineInstanceView + :param license_type: Specifies that the image or disk that is being used was licensed on- + premises. :code:`
    `:code:`
    ` Possible values for Windows Server operating system are: + :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server + :code:`
    `:code:`
    ` Possible values for Linux Server operating system are: + :code:`
    `:code:`
    ` RHEL_BYOS (for RHEL) :code:`
    `:code:`
    ` SLES_BYOS (for SUSE) + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` `Azure Hybrid Use Benefit for Linux Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :type license_type: str + :ivar vm_id: Specifies the VM unique ID which is a 128-bits identifier that is encoded and + stored in all Azure IaaS VMs SMBIOS and can be read using platform BIOS commands. + :vartype vm_id: str + :param extensions_time_budget: Specifies the time alloted for all extensions to start. The time + duration should be between 15 minutes and 120 minutes (inclusive) and should be specified in + ISO 8601 format. The default value is 90 minutes (PT1H30M). :code:`
    `:code:`
    ` Minimum + api-version: 2020-06-01. + :type extensions_time_budget: str + :param platform_fault_domain: Specifies the scale set logical fault domain into which the + Virtual Machine will be created. By default, the Virtual Machine will by automatically assigned + to a fault domain that best maintains balance across available fault + domains.:code:`
    `:code:`
  • `This is applicable only if the 'virtualMachineScaleSet' + property of this Virtual Machine is set.:code:`
  • `The Virtual Machine Scale Set that is + referenced, must have 'platformFaultDomainCount' > 1.:code:`
  • `This property cannot be + updated once the Virtual Machine is created.:code:`
  • `Fault domain assignment can be viewed + in the Virtual Machine Instance View.:code:`
    `:code:`
    `Minimum api‐version: 2020‐12‐01. + :type platform_fault_domain: int + :param user_data: UserData for the VM, which must be base-64 encoded. Customer should not pass + any secrets in here. :code:`
    `:code:`
    `Minimum api-version: 2021-03-01. + :type user_data: str """ + _validation = { + 'provisioning_state': {'readonly': True}, + 'instance_view': {'readonly': True}, + 'vm_id': {'readonly': True}, + } + _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'plan': {'key': 'plan', 'type': 'Plan'}, + 'identity': {'key': 'identity', 'type': 'VirtualMachineIdentity'}, + 'zones': {'key': 'zones', 'type': '[str]'}, + 'hardware_profile': {'key': 'properties.hardwareProfile', 'type': 'HardwareProfile'}, + 'storage_profile': {'key': 'properties.storageProfile', 'type': 'StorageProfile'}, + 'additional_capabilities': {'key': 'properties.additionalCapabilities', 'type': 'AdditionalCapabilities'}, + 'os_profile': {'key': 'properties.osProfile', 'type': 'OSProfile'}, + 'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'}, + 'security_profile': {'key': 'properties.securityProfile', 'type': 'SecurityProfile'}, + 'diagnostics_profile': {'key': 'properties.diagnosticsProfile', 'type': 'DiagnosticsProfile'}, + 'availability_set': {'key': 'properties.availabilitySet', 'type': 'SubResource'}, + 'virtual_machine_scale_set': {'key': 'properties.virtualMachineScaleSet', 'type': 'SubResource'}, + 'proximity_placement_group': {'key': 'properties.proximityPlacementGroup', 'type': 'SubResource'}, + 'priority': {'key': 'properties.priority', 'type': 'str'}, + 'eviction_policy': {'key': 'properties.evictionPolicy', 'type': 'str'}, + 'billing_profile': {'key': 'properties.billingProfile', 'type': 'BillingProfile'}, + 'host': {'key': 'properties.host', 'type': 'SubResource'}, + 'host_group': {'key': 'properties.hostGroup', 'type': 'SubResource'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'instance_view': {'key': 'properties.instanceView', 'type': 'VirtualMachineInstanceView'}, + 'license_type': {'key': 'properties.licenseType', 'type': 'str'}, + 'vm_id': {'key': 'properties.vmId', 'type': 'str'}, + 'extensions_time_budget': {'key': 'properties.extensionsTimeBudget', 'type': 'str'}, + 'platform_fault_domain': {'key': 'properties.platformFaultDomain', 'type': 'int'}, + 'user_data': {'key': 'properties.userData', 'type': 'str'}, } def __init__( self, **kwargs ): - super(SubResource, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - - -class UpdateDomain(msrest.serialization.Model): - """Defines an update domain for the cloud service. + super(VirtualMachineUpdate, self).__init__(**kwargs) + self.plan = kwargs.get('plan', None) + self.identity = kwargs.get('identity', None) + self.zones = kwargs.get('zones', None) + self.hardware_profile = kwargs.get('hardware_profile', None) + self.storage_profile = kwargs.get('storage_profile', None) + self.additional_capabilities = kwargs.get('additional_capabilities', None) + self.os_profile = kwargs.get('os_profile', None) + self.network_profile = kwargs.get('network_profile', None) + self.security_profile = kwargs.get('security_profile', None) + self.diagnostics_profile = kwargs.get('diagnostics_profile', None) + self.availability_set = kwargs.get('availability_set', None) + self.virtual_machine_scale_set = kwargs.get('virtual_machine_scale_set', None) + self.proximity_placement_group = kwargs.get('proximity_placement_group', None) + self.priority = kwargs.get('priority', None) + self.eviction_policy = kwargs.get('eviction_policy', None) + self.billing_profile = kwargs.get('billing_profile', None) + self.host = kwargs.get('host', None) + self.host_group = kwargs.get('host_group', None) + self.provisioning_state = None + self.instance_view = None + self.license_type = kwargs.get('license_type', None) + self.vm_id = None + self.extensions_time_budget = kwargs.get('extensions_time_budget', None) + self.platform_fault_domain = kwargs.get('platform_fault_domain', None) + self.user_data = kwargs.get('user_data', None) + + +class VMScaleSetConvertToSinglePlacementGroupInput(msrest.serialization.Model): + """VMScaleSetConvertToSinglePlacementGroupInput. + + :param active_placement_group_id: Id of the placement group in which you want future virtual + machine instances to be placed. To query placement group Id, please use Virtual Machine Scale + Set VMs - Get API. If not provided, the platform will choose one with maximum number of virtual + machine instances. + :type active_placement_group_id: str + """ - Variables are only populated by the server, and will be ignored when sending a request. + _attribute_map = { + 'active_placement_group_id': {'key': 'activePlacementGroupId', 'type': 'str'}, + } - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str + def __init__( + self, + **kwargs + ): + super(VMScaleSetConvertToSinglePlacementGroupInput, self).__init__(**kwargs) + self.active_placement_group_id = kwargs.get('active_placement_group_id', None) + + +class WindowsConfiguration(msrest.serialization.Model): + """Specifies Windows operating system settings on the virtual machine. + + :param provision_vm_agent: Indicates whether virtual machine agent should be provisioned on the + virtual machine. :code:`
    `:code:`
    ` When this property is not specified in the request + body, default behavior is to set it to true. This will ensure that VM Agent is installed on + the VM so that extensions can be added to the VM later. + :type provision_vm_agent: bool + :param enable_automatic_updates: Indicates whether Automatic Updates is enabled for the Windows + virtual machine. Default value is true. :code:`
    `:code:`
    ` For virtual machine scale + sets, this property can be updated and updates will take effect on OS reprovisioning. + :type enable_automatic_updates: bool + :param time_zone: Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". + :code:`
    `:code:`
    ` Possible values can be `TimeZoneInfo.Id + `_ + value from time zones returned by `TimeZoneInfo.GetSystemTimeZones + `_. + :type time_zone: str + :param additional_unattend_content: Specifies additional base-64 encoded XML formatted + information that can be included in the Unattend.xml file, which is used by Windows Setup. + :type additional_unattend_content: + list[~azure.mgmt.compute.v2021_03_01.models.AdditionalUnattendContent] + :param patch_settings: [Preview Feature] Specifies settings related to VM Guest Patching on + Windows. + :type patch_settings: ~azure.mgmt.compute.v2021_03_01.models.PatchSettings + :param win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows + PowerShell. + :type win_rm: ~azure.mgmt.compute.v2021_03_01.models.WinRMConfiguration """ - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, + _attribute_map = { + 'provision_vm_agent': {'key': 'provisionVMAgent', 'type': 'bool'}, + 'enable_automatic_updates': {'key': 'enableAutomaticUpdates', 'type': 'bool'}, + 'time_zone': {'key': 'timeZone', 'type': 'str'}, + 'additional_unattend_content': {'key': 'additionalUnattendContent', 'type': '[AdditionalUnattendContent]'}, + 'patch_settings': {'key': 'patchSettings', 'type': 'PatchSettings'}, + 'win_rm': {'key': 'winRM', 'type': 'WinRMConfiguration'}, } + def __init__( + self, + **kwargs + ): + super(WindowsConfiguration, self).__init__(**kwargs) + self.provision_vm_agent = kwargs.get('provision_vm_agent', None) + self.enable_automatic_updates = kwargs.get('enable_automatic_updates', None) + self.time_zone = kwargs.get('time_zone', None) + self.additional_unattend_content = kwargs.get('additional_unattend_content', None) + self.patch_settings = kwargs.get('patch_settings', None) + self.win_rm = kwargs.get('win_rm', None) + + +class WindowsParameters(msrest.serialization.Model): + """Input for InstallPatches on a Windows VM, as directly received by the API. + + :param classifications_to_include: The update classifications to select when installing patches + for Windows. + :type classifications_to_include: list[str or + ~azure.mgmt.compute.v2021_03_01.models.VMGuestPatchClassificationWindows] + :param kb_numbers_to_include: Kbs to include in the patch operation. + :type kb_numbers_to_include: list[str] + :param kb_numbers_to_exclude: Kbs to exclude in the patch operation. + :type kb_numbers_to_exclude: list[str] + :param exclude_kbs_requiring_reboot: Filters out Kbs that don't have an + InstallationRebootBehavior of 'NeverReboots' when this is set to true. + :type exclude_kbs_requiring_reboot: bool + :param max_patch_publish_date: This is used to install patches that were published on or before + this given max published date. + :type max_patch_publish_date: ~datetime.datetime + """ + _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, + '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'}, } def __init__( self, **kwargs ): - super(UpdateDomain, self).__init__(**kwargs) - self.id = None - self.name = None - + super(WindowsParameters, self).__init__(**kwargs) + self.classifications_to_include = kwargs.get('classifications_to_include', None) + self.kb_numbers_to_include = kwargs.get('kb_numbers_to_include', None) + self.kb_numbers_to_exclude = kwargs.get('kb_numbers_to_exclude', None) + self.exclude_kbs_requiring_reboot = kwargs.get('exclude_kbs_requiring_reboot', None) + self.max_patch_publish_date = kwargs.get('max_patch_publish_date', None) -class UpdateDomainListResult(msrest.serialization.Model): - """UpdateDomainListResult. - All required parameters must be populated in order to send to Azure. +class WinRMConfiguration(msrest.serialization.Model): + """Describes Windows Remote Management configuration of the VM. - :param value: Required. - :type value: list[~azure.mgmt.compute.v2021_03_01.models.UpdateDomain] - :param next_link: - :type next_link: str + :param listeners: The list of Windows Remote Management listeners. + :type listeners: list[~azure.mgmt.compute.v2021_03_01.models.WinRMListener] """ - _validation = { - 'value': {'required': True}, + _attribute_map = { + 'listeners': {'key': 'listeners', 'type': '[WinRMListener]'}, } + def __init__( + self, + **kwargs + ): + super(WinRMConfiguration, self).__init__(**kwargs) + self.listeners = kwargs.get('listeners', None) + + +class WinRMListener(msrest.serialization.Model): + """Describes Protocol and thumbprint of Windows Remote Management listener. + + :param protocol: Specifies the protocol of WinRM listener. :code:`
    `:code:`
    ` Possible + values are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https**. Possible values include: + "Http", "Https". + :type protocol: str or ~azure.mgmt.compute.v2021_03_01.models.ProtocolTypes + :param certificate_url: This is the URL of a certificate that has been uploaded to Key Vault as + a secret. For adding a secret to the Key Vault, see `Add a key or secret to the key vault + `_. In this case, your + certificate needs to be It is the Base64 encoding of the following JSON Object which is encoded + in UTF-8: :code:`
    `:code:`
    ` {:code:`
    ` "data":":code:``",:code:`
    ` "dataType":"pfx",:code:`
    ` "password":":code:``":code:`
    `}. + :type certificate_url: str + """ + _attribute_map = { - 'value': {'key': 'value', 'type': '[UpdateDomain]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'protocol': {'key': 'protocol', 'type': 'str'}, + 'certificate_url': {'key': 'certificateUrl', 'type': 'str'}, } def __init__( self, **kwargs ): - super(UpdateDomainListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) + super(WinRMListener, self).__init__(**kwargs) + self.protocol = kwargs.get('protocol', None) + self.certificate_url = kwargs.get('certificate_url', None) diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/models/_models_py3.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/models/_models_py3.py index c90ef6926bc5b..e9ec72e713c54 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/models/_models_py3.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/models/_models_py3.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import datetime from typing import Dict, List, Optional, Union import msrest.serialization @@ -13,6 +14,100 @@ from ._compute_management_client_enums import * +class AdditionalCapabilities(msrest.serialization.Model): + """Enables or disables a capability on the virtual machine or virtual machine scale set. + + :param ultra_ssd_enabled: The flag that enables or disables a capability to have one or more + managed data disks with UltraSSD_LRS storage account type on the VM or VMSS. Managed disks with + storage account type UltraSSD_LRS can be added to a virtual machine or virtual machine scale + set only if this property is enabled. + :type ultra_ssd_enabled: bool + """ + + _attribute_map = { + 'ultra_ssd_enabled': {'key': 'ultraSSDEnabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + ultra_ssd_enabled: Optional[bool] = None, + **kwargs + ): + super(AdditionalCapabilities, self).__init__(**kwargs) + self.ultra_ssd_enabled = ultra_ssd_enabled + + +class AdditionalUnattendContent(msrest.serialization.Model): + """Specifies additional XML formatted information that can be included in the Unattend.xml file, which is used by Windows Setup. Contents are defined by setting name, component name, and the pass in which the content is applied. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar pass_name: The pass name. Currently, the only allowable value is OobeSystem. Default + value: "OobeSystem". + :vartype pass_name: str + :ivar component_name: The component name. Currently, the only allowable value is Microsoft- + Windows-Shell-Setup. Default value: "Microsoft-Windows-Shell-Setup". + :vartype component_name: str + :param setting_name: Specifies the name of the setting to which the content applies. Possible + values are: FirstLogonCommands and AutoLogon. Possible values include: "AutoLogon", + "FirstLogonCommands". + :type setting_name: str or ~azure.mgmt.compute.v2021_03_01.models.SettingNames + :param content: Specifies the XML formatted content that is added to the unattend.xml file for + the specified path and component. The XML must be less than 4KB and must include the root + element for the setting or feature that is being inserted. + :type content: str + """ + + _validation = { + 'pass_name': {'constant': True}, + 'component_name': {'constant': True}, + } + + _attribute_map = { + 'pass_name': {'key': 'passName', 'type': 'str'}, + 'component_name': {'key': 'componentName', 'type': 'str'}, + 'setting_name': {'key': 'settingName', 'type': 'str'}, + 'content': {'key': 'content', 'type': 'str'}, + } + + pass_name = "OobeSystem" + component_name = "Microsoft-Windows-Shell-Setup" + + def __init__( + self, + *, + setting_name: Optional[Union[str, "SettingNames"]] = None, + content: Optional[str] = None, + **kwargs + ): + super(AdditionalUnattendContent, self).__init__(**kwargs) + self.setting_name = setting_name + self.content = content + + +class ApiEntityReference(msrest.serialization.Model): + """The API entity reference. + + :param id: The ARM resource id in the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + super(ApiEntityReference, self).__init__(**kwargs) + self.id = id + + class ApiError(msrest.serialization.Model): """Api error. @@ -85,8 +180,99 @@ def __init__( self.target = target -class CloudService(msrest.serialization.Model): - """Describes the cloud service. +class AutomaticOSUpgradePolicy(msrest.serialization.Model): + """The configuration parameters used for performing automatic OS upgrade. + + :param enable_automatic_os_upgrade: Indicates whether OS upgrades should automatically be + applied to scale set instances in a rolling fashion when a newer version of the OS image + becomes available. Default value is false. :code:`
    `:code:`
    ` If this is set to true for + Windows based scale sets, `enableAutomaticUpdates + `_ is automatically set to false and cannot be set to true. + :type enable_automatic_os_upgrade: bool + :param disable_automatic_rollback: Whether OS image rollback feature should be disabled. + Default value is false. + :type disable_automatic_rollback: bool + """ + + _attribute_map = { + 'enable_automatic_os_upgrade': {'key': 'enableAutomaticOSUpgrade', 'type': 'bool'}, + 'disable_automatic_rollback': {'key': 'disableAutomaticRollback', 'type': 'bool'}, + } + + def __init__( + self, + *, + enable_automatic_os_upgrade: Optional[bool] = None, + disable_automatic_rollback: Optional[bool] = None, + **kwargs + ): + super(AutomaticOSUpgradePolicy, self).__init__(**kwargs) + self.enable_automatic_os_upgrade = enable_automatic_os_upgrade + self.disable_automatic_rollback = disable_automatic_rollback + + +class AutomaticOSUpgradeProperties(msrest.serialization.Model): + """Describes automatic OS upgrade properties on the image. + + All required parameters must be populated in order to send to Azure. + + :param automatic_os_upgrade_supported: Required. Specifies whether automatic OS upgrade is + supported on the image. + :type automatic_os_upgrade_supported: bool + """ + + _validation = { + 'automatic_os_upgrade_supported': {'required': True}, + } + + _attribute_map = { + 'automatic_os_upgrade_supported': {'key': 'automaticOSUpgradeSupported', 'type': 'bool'}, + } + + def __init__( + self, + *, + automatic_os_upgrade_supported: bool, + **kwargs + ): + super(AutomaticOSUpgradeProperties, self).__init__(**kwargs) + self.automatic_os_upgrade_supported = automatic_os_upgrade_supported + + +class AutomaticRepairsPolicy(msrest.serialization.Model): + """Specifies the configuration parameters for automatic repairs on the virtual machine scale set. + + :param enabled: Specifies whether automatic repairs should be enabled on the virtual machine + scale set. The default value is false. + :type enabled: bool + :param grace_period: The amount of time for which automatic repairs are suspended due to a + state change on VM. The grace time starts after the state change has completed. This helps + avoid premature or accidental repairs. The time duration should be specified in ISO 8601 + format. The minimum allowed grace period is 30 minutes (PT30M), which is also the default + value. The maximum allowed grace period is 90 minutes (PT90M). + :type grace_period: str + """ + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'grace_period': {'key': 'gracePeriod', 'type': 'str'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + grace_period: Optional[str] = None, + **kwargs + ): + super(AutomaticRepairsPolicy, self).__init__(**kwargs) + self.enabled = enabled + self.grace_period = grace_period + + +class Resource(msrest.serialization.Model): + """The Resource model definition. Variables are only populated by the server, and will be ignored when sending a request. @@ -102,8 +288,6 @@ class CloudService(msrest.serialization.Model): :type location: str :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param properties: Cloud service properties. - :type properties: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceProperties """ _validation = { @@ -119,7 +303,6 @@ class CloudService(msrest.serialization.Model): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'CloudServiceProperties'}, } def __init__( @@ -127,181 +310,8137 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - properties: Optional["CloudServiceProperties"] = None, **kwargs ): - super(CloudService, self).__init__(**kwargs) + super(Resource, self).__init__(**kwargs) self.id = None self.name = None self.type = None self.location = location self.tags = tags - self.properties = properties -class CloudServiceExtensionProfile(msrest.serialization.Model): - """Describes a cloud service extension profile. +class AvailabilitySet(Resource): + """Specifies information about the availability set that the virtual machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see `Manage the availability of virtual machines `_. :code:`
    `:code:`
    ` For more information on Azure planned maintenance, see `Planned maintenance for virtual machines in Azure `_ :code:`
    `:code:`
    ` Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. - :param extensions: List of extensions for the cloud service. - :type extensions: list[~azure.mgmt.compute.v2021_03_01.models.Extension] + 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 id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: Sku of the availability set, only name is required to be set. See + AvailabilitySetSkuTypes for possible set of values. Use 'Aligned' for virtual machines with + managed disks and 'Classic' for virtual machines with unmanaged disks. Default value is + 'Classic'. + :type sku: ~azure.mgmt.compute.v2021_03_01.models.Sku + :param platform_update_domain_count: Update Domain count. + :type platform_update_domain_count: int + :param platform_fault_domain_count: Fault Domain count. + :type platform_fault_domain_count: int + :param virtual_machines: A list of references to all virtual machines in the availability set. + :type virtual_machines: list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + :param proximity_placement_group: Specifies information about the proximity placement group + that the availability set should be assigned to. :code:`
    `:code:`
    `Minimum api-version: + 2018-04-01. + :type proximity_placement_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'statuses': {'readonly': True}, + } + _attribute_map = { - 'extensions': {'key': 'extensions', 'type': '[Extension]'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'platform_update_domain_count': {'key': 'properties.platformUpdateDomainCount', 'type': 'int'}, + 'platform_fault_domain_count': {'key': 'properties.platformFaultDomainCount', 'type': 'int'}, + 'virtual_machines': {'key': 'properties.virtualMachines', 'type': '[SubResource]'}, + 'proximity_placement_group': {'key': 'properties.proximityPlacementGroup', 'type': 'SubResource'}, + 'statuses': {'key': 'properties.statuses', 'type': '[InstanceViewStatus]'}, } def __init__( self, *, - extensions: Optional[List["Extension"]] = None, + location: str, + tags: Optional[Dict[str, str]] = None, + sku: Optional["Sku"] = None, + platform_update_domain_count: Optional[int] = None, + platform_fault_domain_count: Optional[int] = None, + virtual_machines: Optional[List["SubResource"]] = None, + proximity_placement_group: Optional["SubResource"] = None, **kwargs ): - super(CloudServiceExtensionProfile, self).__init__(**kwargs) - self.extensions = extensions + super(AvailabilitySet, self).__init__(location=location, tags=tags, **kwargs) + self.sku = sku + self.platform_update_domain_count = platform_update_domain_count + self.platform_fault_domain_count = platform_fault_domain_count + self.virtual_machines = virtual_machines + self.proximity_placement_group = proximity_placement_group + self.statuses = None -class CloudServiceExtensionProperties(msrest.serialization.Model): - """Extension Properties. +class AvailabilitySetListResult(msrest.serialization.Model): + """The List Availability Set operation response. - 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. - :param publisher: The name of the extension handler publisher. - :type publisher: str - :param type: Specifies the type of the extension. - :type type: str - :param type_handler_version: Specifies the version of the extension. Specifies the version of - the extension. If this element is not specified or an asterisk (*) is used as the value, the - latest version of the extension is used. If the value is specified with a major version number - and an asterisk as the minor version number (X.), the latest minor version of the specified - major version is selected. If a major version number and a minor version number are specified - (X.Y), the specific extension version is selected. If a version is specified, an auto-upgrade - is performed on the role instance. - :type type_handler_version: str - :param auto_upgrade_minor_version: Explicitly specify whether platform can automatically - upgrade typeHandlerVersion to higher minor versions when they become available. - :type auto_upgrade_minor_version: bool - :param settings: Public settings for the extension. For JSON extensions, this is the JSON - settings for the extension. For XML Extension (like RDP), this is the XML setting for the - extension. - :type settings: str - :param protected_settings: Protected settings for the extension which are encrypted before sent - to the role instance. - :type protected_settings: str - :param protected_settings_from_key_vault: - :type protected_settings_from_key_vault: - ~azure.mgmt.compute.v2021_03_01.models.CloudServiceVaultAndSecretReference - :param force_update_tag: Tag to force apply the provided public and protected settings. - Changing the tag value allows for re-running the extension without changing any of the public - or protected settings. - If forceUpdateTag is not changed, updates to public or protected settings would still be - applied by the handler. - If neither forceUpdateTag nor any of public or protected settings change, extension would flow - to the role instance with the same sequence-number, and - it is up to handler implementation whether to re-run it or not. - :type force_update_tag: str - :ivar provisioning_state: The provisioning state, which only appears in the response. - :vartype provisioning_state: str - :param roles_applied_to: Optional list of roles to apply this extension. If property is not - specified or '*' is specified, extension is applied to all roles in the cloud service. - :type roles_applied_to: list[str] + :param value: Required. The list of availability sets. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.AvailabilitySet] + :param next_link: The URI to fetch the next page of AvailabilitySets. Call ListNext() with this + URI to fetch the next page of AvailabilitySets. + :type next_link: str """ _validation = { - 'provisioning_state': {'readonly': True}, + 'value': {'required': True}, } _attribute_map = { - 'publisher': {'key': 'publisher', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'type_handler_version': {'key': 'typeHandlerVersion', 'type': 'str'}, - 'auto_upgrade_minor_version': {'key': 'autoUpgradeMinorVersion', 'type': 'bool'}, - 'settings': {'key': 'settings', 'type': 'str'}, - 'protected_settings': {'key': 'protectedSettings', 'type': 'str'}, - 'protected_settings_from_key_vault': {'key': 'protectedSettingsFromKeyVault', 'type': 'CloudServiceVaultAndSecretReference'}, - 'force_update_tag': {'key': 'forceUpdateTag', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'roles_applied_to': {'key': 'rolesAppliedTo', 'type': '[str]'}, + 'value': {'key': 'value', 'type': '[AvailabilitySet]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, *, - publisher: Optional[str] = None, - type: Optional[str] = None, - type_handler_version: Optional[str] = None, - auto_upgrade_minor_version: Optional[bool] = None, - settings: Optional[str] = None, - protected_settings: Optional[str] = None, - protected_settings_from_key_vault: Optional["CloudServiceVaultAndSecretReference"] = None, - force_update_tag: Optional[str] = None, - roles_applied_to: Optional[List[str]] = None, + value: List["AvailabilitySet"], + next_link: Optional[str] = None, **kwargs ): - super(CloudServiceExtensionProperties, self).__init__(**kwargs) - self.publisher = publisher - self.type = type - self.type_handler_version = type_handler_version - self.auto_upgrade_minor_version = auto_upgrade_minor_version - self.settings = settings - self.protected_settings = protected_settings - self.protected_settings_from_key_vault = protected_settings_from_key_vault - self.force_update_tag = force_update_tag - self.provisioning_state = None - self.roles_applied_to = roles_applied_to - + super(AvailabilitySetListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link -class CloudServiceInstanceView(msrest.serialization.Model): - """InstanceView of CloudService as a whole. - Variables are only populated by the server, and will be ignored when sending a request. +class UpdateResource(msrest.serialization.Model): + """The Update Resource model definition. - :param role_instance: Instance view statuses. - :type role_instance: ~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatusesSummary - :ivar sdk_version: The version of the SDK that was used to generate the package for the cloud - service. - :vartype sdk_version: str - :ivar private_ids: Specifies a list of unique identifiers generated internally for the cloud - service. :code:`
    `:code:`
    ` NOTE: If you are using Azure Diagnostics extension, this - property can be used as 'DeploymentId' for querying details. - :vartype private_ids: list[str] - :ivar statuses: - :vartype statuses: list[~azure.mgmt.compute.v2021_03_01.models.ResourceInstanceViewStatus] + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] """ - _validation = { - 'sdk_version': {'readonly': True}, - 'private_ids': {'readonly': True}, - 'statuses': {'readonly': True}, - } - _attribute_map = { - 'role_instance': {'key': 'roleInstance', 'type': 'InstanceViewStatusesSummary'}, - 'sdk_version': {'key': 'sdkVersion', 'type': 'str'}, - 'private_ids': {'key': 'privateIds', 'type': '[str]'}, - 'statuses': {'key': 'statuses', 'type': '[ResourceInstanceViewStatus]'}, + 'tags': {'key': 'tags', 'type': '{str}'}, } def __init__( self, *, - role_instance: Optional["InstanceViewStatusesSummary"] = None, + tags: Optional[Dict[str, str]] = None, **kwargs ): - super(CloudServiceInstanceView, self).__init__(**kwargs) - self.role_instance = role_instance - self.sdk_version = None - self.private_ids = None - self.statuses = None + super(UpdateResource, self).__init__(**kwargs) + self.tags = tags -class CloudServiceListResult(msrest.serialization.Model): - """CloudServiceListResult. +class AvailabilitySetUpdate(UpdateResource): + """Specifies information about the availability set that the virtual machine should be assigned to. Only tags may be updated. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: Sku of the availability set. + :type sku: ~azure.mgmt.compute.v2021_03_01.models.Sku + :param platform_update_domain_count: Update Domain count. + :type platform_update_domain_count: int + :param platform_fault_domain_count: Fault Domain count. + :type platform_fault_domain_count: int + :param virtual_machines: A list of references to all virtual machines in the availability set. + :type virtual_machines: list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + :param proximity_placement_group: Specifies information about the proximity placement group + that the availability set should be assigned to. :code:`
    `:code:`
    `Minimum api-version: + 2018-04-01. + :type proximity_placement_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar statuses: The resource status information. + :vartype statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + """ + + _validation = { + 'statuses': {'readonly': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'platform_update_domain_count': {'key': 'properties.platformUpdateDomainCount', 'type': 'int'}, + 'platform_fault_domain_count': {'key': 'properties.platformFaultDomainCount', 'type': 'int'}, + 'virtual_machines': {'key': 'properties.virtualMachines', 'type': '[SubResource]'}, + 'proximity_placement_group': {'key': 'properties.proximityPlacementGroup', 'type': 'SubResource'}, + 'statuses': {'key': 'properties.statuses', 'type': '[InstanceViewStatus]'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + sku: Optional["Sku"] = None, + platform_update_domain_count: Optional[int] = None, + platform_fault_domain_count: Optional[int] = None, + virtual_machines: Optional[List["SubResource"]] = None, + proximity_placement_group: Optional["SubResource"] = None, + **kwargs + ): + super(AvailabilitySetUpdate, self).__init__(tags=tags, **kwargs) + self.sku = sku + self.platform_update_domain_count = platform_update_domain_count + self.platform_fault_domain_count = platform_fault_domain_count + self.virtual_machines = virtual_machines + self.proximity_placement_group = proximity_placement_group + self.statuses = None + + +class AvailablePatchSummary(msrest.serialization.Model): + """Describes the properties of an virtual machine instance view for available patch summary. + + 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 "Unknown", "Failed", "Succeeded", + or "CompletedWithWarnings.". Possible values include: "Unknown", "InProgress", "Failed", + "Succeeded", "CompletedWithWarnings". + :vartype status: str or ~azure.mgmt.compute.v2021_03_01.models.PatchOperationStatus + :ivar assessment_activity_id: The activity ID of the operation that produced this result. It is + used to correlate across CRP and extension logs. + :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 critical_and_security_patch_count: The number of critical or security patches that have + been detected as available and not yet installed. + :vartype critical_and_security_patch_count: int + :ivar other_patch_count: The number of all available patches excluding critical and security. + :vartype other_patch_count: int + :ivar start_time: The UTC timestamp when the operation began. + :vartype start_time: ~datetime.datetime + :ivar last_modified_time: The UTC timestamp when the operation began. + :vartype last_modified_time: ~datetime.datetime + :ivar error: The errors that were encountered during execution of the operation. The details + array contains the list of them. + :vartype error: ~azure.mgmt.compute.v2021_03_01.models.ApiError + """ + + _validation = { + 'status': {'readonly': True}, + 'assessment_activity_id': {'readonly': True}, + 'reboot_pending': {'readonly': True}, + 'critical_and_security_patch_count': {'readonly': True}, + 'other_patch_count': {'readonly': True}, + 'start_time': {'readonly': True}, + 'last_modified_time': {'readonly': True}, + 'error': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'assessment_activity_id': {'key': 'assessmentActivityId', 'type': 'str'}, + 'reboot_pending': {'key': 'rebootPending', 'type': 'bool'}, + 'critical_and_security_patch_count': {'key': 'criticalAndSecurityPatchCount', 'type': 'int'}, + 'other_patch_count': {'key': 'otherPatchCount', 'type': 'int'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'last_modified_time': {'key': 'lastModifiedTime', 'type': 'iso-8601'}, + 'error': {'key': 'error', 'type': 'ApiError'}, + } + + def __init__( + self, + **kwargs + ): + super(AvailablePatchSummary, self).__init__(**kwargs) + self.status = None + self.assessment_activity_id = None + self.reboot_pending = None + self.critical_and_security_patch_count = None + self.other_patch_count = None + self.start_time = None + self.last_modified_time = None + self.error = None + + +class BillingProfile(msrest.serialization.Model): + """Specifies the billing related details of a Azure Spot VM or VMSS. :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + + :param max_price: Specifies the maximum price you are willing to pay for a Azure Spot VM/VMSS. + This price is in US Dollars. :code:`
    `:code:`
    ` This price will be compared with the + current Azure Spot price for the VM size. Also, the prices are compared at the time of + create/update of Azure Spot VM/VMSS and the operation will only succeed if the maxPrice is + greater than the current Azure Spot price. :code:`
    `:code:`
    ` The maxPrice will also be + used for evicting a Azure Spot VM/VMSS if the current Azure Spot price goes beyond the maxPrice + after creation of VM/VMSS. :code:`
    `:code:`
    ` Possible values are: + :code:`
    `:code:`
    ` - Any decimal value greater than zero. Example: 0.01538 + :code:`
    `:code:`
    ` -1 – indicates default price to be up-to on-demand. + :code:`
    `:code:`
    ` You can set the maxPrice to -1 to indicate that the Azure Spot VM/VMSS + should not be evicted for price reasons. Also, the default max price is -1 if it is not + provided by you. :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :type max_price: float + """ + + _attribute_map = { + 'max_price': {'key': 'maxPrice', 'type': 'float'}, + } + + def __init__( + self, + *, + max_price: Optional[float] = None, + **kwargs + ): + super(BillingProfile, self).__init__(**kwargs) + self.max_price = max_price + + +class BootDiagnostics(msrest.serialization.Model): + """Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. :code:`
    `:code:`
    ` You can easily view the output of your console log. :code:`
    `:code:`
    ` Azure also enables you to see a screenshot of the VM from the hypervisor. + + :param enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :type enabled: bool + :param storage_uri: Uri of the storage account to use for placing the console output and + screenshot. :code:`
    `:code:`
    `If storageUri is not specified while enabling boot + diagnostics, managed storage will be used. + :type storage_uri: str + """ + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'storage_uri': {'key': 'storageUri', 'type': 'str'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + storage_uri: Optional[str] = None, + **kwargs + ): + super(BootDiagnostics, self).__init__(**kwargs) + self.enabled = enabled + self.storage_uri = storage_uri + + +class BootDiagnosticsInstanceView(msrest.serialization.Model): + """The instance view of a virtual machine boot diagnostics. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar console_screenshot_blob_uri: The console screenshot blob URI. + :code:`
    `:code:`
    `NOTE: This will **not** be set if boot diagnostics is currently enabled + with managed storage. + :vartype console_screenshot_blob_uri: str + :ivar serial_console_log_blob_uri: The serial console log blob Uri. + :code:`
    `:code:`
    `NOTE: This will **not** be set if boot diagnostics is currently enabled + with managed storage. + :vartype serial_console_log_blob_uri: str + :ivar status: The boot diagnostics status information for the VM. :code:`
    `:code:`
    ` + NOTE: It will be set only if there are errors encountered in enabling boot diagnostics. + :vartype status: ~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus + """ + + _validation = { + 'console_screenshot_blob_uri': {'readonly': True}, + 'serial_console_log_blob_uri': {'readonly': True}, + 'status': {'readonly': True}, + } + + _attribute_map = { + 'console_screenshot_blob_uri': {'key': 'consoleScreenshotBlobUri', 'type': 'str'}, + 'serial_console_log_blob_uri': {'key': 'serialConsoleLogBlobUri', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'InstanceViewStatus'}, + } + + def __init__( + self, + **kwargs + ): + super(BootDiagnosticsInstanceView, self).__init__(**kwargs) + self.console_screenshot_blob_uri = None + self.serial_console_log_blob_uri = None + self.status = None + + +class CloudService(msrest.serialization.Model): + """Describes the cloud service. + + 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 id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param properties: Cloud service properties. + :type properties: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'CloudServiceProperties'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["CloudServiceProperties"] = None, + **kwargs + ): + super(CloudService, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + self.properties = properties + + +class CloudServiceExtensionProfile(msrest.serialization.Model): + """Describes a cloud service extension profile. + + :param extensions: List of extensions for the cloud service. + :type extensions: list[~azure.mgmt.compute.v2021_03_01.models.Extension] + """ + + _attribute_map = { + 'extensions': {'key': 'extensions', 'type': '[Extension]'}, + } + + def __init__( + self, + *, + extensions: Optional[List["Extension"]] = None, + **kwargs + ): + super(CloudServiceExtensionProfile, self).__init__(**kwargs) + self.extensions = extensions + + +class CloudServiceExtensionProperties(msrest.serialization.Model): + """Extension Properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param publisher: The name of the extension handler publisher. + :type publisher: str + :param type: Specifies the type of the extension. + :type type: str + :param type_handler_version: Specifies the version of the extension. Specifies the version of + the extension. If this element is not specified or an asterisk (*) is used as the value, the + latest version of the extension is used. If the value is specified with a major version number + and an asterisk as the minor version number (X.), the latest minor version of the specified + major version is selected. If a major version number and a minor version number are specified + (X.Y), the specific extension version is selected. If a version is specified, an auto-upgrade + is performed on the role instance. + :type type_handler_version: str + :param auto_upgrade_minor_version: Explicitly specify whether platform can automatically + upgrade typeHandlerVersion to higher minor versions when they become available. + :type auto_upgrade_minor_version: bool + :param settings: Public settings for the extension. For JSON extensions, this is the JSON + settings for the extension. For XML Extension (like RDP), this is the XML setting for the + extension. + :type settings: str + :param protected_settings: Protected settings for the extension which are encrypted before sent + to the role instance. + :type protected_settings: str + :param protected_settings_from_key_vault: + :type protected_settings_from_key_vault: + ~azure.mgmt.compute.v2021_03_01.models.CloudServiceVaultAndSecretReference + :param force_update_tag: Tag to force apply the provided public and protected settings. + Changing the tag value allows for re-running the extension without changing any of the public + or protected settings. + If forceUpdateTag is not changed, updates to public or protected settings would still be + applied by the handler. + If neither forceUpdateTag nor any of public or protected settings change, extension would flow + to the role instance with the same sequence-number, and + it is up to handler implementation whether to re-run it or not. + :type force_update_tag: str + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :param roles_applied_to: Optional list of roles to apply this extension. If property is not + specified or '*' is specified, extension is applied to all roles in the cloud service. + :type roles_applied_to: list[str] + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'type_handler_version': {'key': 'typeHandlerVersion', 'type': 'str'}, + 'auto_upgrade_minor_version': {'key': 'autoUpgradeMinorVersion', 'type': 'bool'}, + 'settings': {'key': 'settings', 'type': 'str'}, + 'protected_settings': {'key': 'protectedSettings', 'type': 'str'}, + 'protected_settings_from_key_vault': {'key': 'protectedSettingsFromKeyVault', 'type': 'CloudServiceVaultAndSecretReference'}, + 'force_update_tag': {'key': 'forceUpdateTag', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'roles_applied_to': {'key': 'rolesAppliedTo', 'type': '[str]'}, + } + + def __init__( + self, + *, + publisher: Optional[str] = None, + type: Optional[str] = None, + type_handler_version: Optional[str] = None, + auto_upgrade_minor_version: Optional[bool] = None, + settings: Optional[str] = None, + protected_settings: Optional[str] = None, + protected_settings_from_key_vault: Optional["CloudServiceVaultAndSecretReference"] = None, + force_update_tag: Optional[str] = None, + roles_applied_to: Optional[List[str]] = None, + **kwargs + ): + super(CloudServiceExtensionProperties, self).__init__(**kwargs) + self.publisher = publisher + self.type = type + self.type_handler_version = type_handler_version + self.auto_upgrade_minor_version = auto_upgrade_minor_version + self.settings = settings + self.protected_settings = protected_settings + self.protected_settings_from_key_vault = protected_settings_from_key_vault + self.force_update_tag = force_update_tag + self.provisioning_state = None + self.roles_applied_to = roles_applied_to + + +class CloudServiceInstanceView(msrest.serialization.Model): + """InstanceView of CloudService as a whole. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param role_instance: Instance view statuses. + :type role_instance: ~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatusesSummary + :ivar sdk_version: The version of the SDK that was used to generate the package for the cloud + service. + :vartype sdk_version: str + :ivar private_ids: Specifies a list of unique identifiers generated internally for the cloud + service. :code:`
    `:code:`
    ` NOTE: If you are using Azure Diagnostics extension, this + property can be used as 'DeploymentId' for querying details. + :vartype private_ids: list[str] + :ivar statuses: + :vartype statuses: list[~azure.mgmt.compute.v2021_03_01.models.ResourceInstanceViewStatus] + """ + + _validation = { + 'sdk_version': {'readonly': True}, + 'private_ids': {'readonly': True}, + 'statuses': {'readonly': True}, + } + + _attribute_map = { + 'role_instance': {'key': 'roleInstance', 'type': 'InstanceViewStatusesSummary'}, + 'sdk_version': {'key': 'sdkVersion', 'type': 'str'}, + 'private_ids': {'key': 'privateIds', 'type': '[str]'}, + 'statuses': {'key': 'statuses', 'type': '[ResourceInstanceViewStatus]'}, + } + + def __init__( + self, + *, + role_instance: Optional["InstanceViewStatusesSummary"] = None, + **kwargs + ): + super(CloudServiceInstanceView, self).__init__(**kwargs) + self.role_instance = role_instance + self.sdk_version = None + self.private_ids = None + self.statuses = None + + +class CloudServiceListResult(msrest.serialization.Model): + """CloudServiceListResult. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.CloudService] + :param next_link: + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CloudService]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["CloudService"], + next_link: Optional[str] = None, + **kwargs + ): + super(CloudServiceListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class CloudServiceNetworkProfile(msrest.serialization.Model): + """Network Profile for the cloud service. + + :param load_balancer_configurations: List of Load balancer configurations. Cloud service can + have up to two load balancer configurations, corresponding to a Public Load Balancer and an + Internal Load Balancer. + :type load_balancer_configurations: + list[~azure.mgmt.compute.v2021_03_01.models.LoadBalancerConfiguration] + :param swappable_cloud_service: The id reference of the cloud service containing the target IP + with which the subject cloud service can perform a swap. This property cannot be updated once + it is set. The swappable cloud service referred by this id must be present otherwise an error + will be thrown. + :type swappable_cloud_service: ~azure.mgmt.compute.v2021_03_01.models.SubResource + """ + + _attribute_map = { + 'load_balancer_configurations': {'key': 'loadBalancerConfigurations', 'type': '[LoadBalancerConfiguration]'}, + 'swappable_cloud_service': {'key': 'swappableCloudService', 'type': 'SubResource'}, + } + + def __init__( + self, + *, + load_balancer_configurations: Optional[List["LoadBalancerConfiguration"]] = None, + swappable_cloud_service: Optional["SubResource"] = None, + **kwargs + ): + super(CloudServiceNetworkProfile, self).__init__(**kwargs) + self.load_balancer_configurations = load_balancer_configurations + self.swappable_cloud_service = swappable_cloud_service + + +class CloudServiceOsProfile(msrest.serialization.Model): + """Describes the OS profile for the cloud service. + + :param secrets: Specifies set of certificates that should be installed onto the role instances. + :type secrets: list[~azure.mgmt.compute.v2021_03_01.models.CloudServiceVaultSecretGroup] + """ + + _attribute_map = { + 'secrets': {'key': 'secrets', 'type': '[CloudServiceVaultSecretGroup]'}, + } + + def __init__( + self, + *, + secrets: Optional[List["CloudServiceVaultSecretGroup"]] = None, + **kwargs + ): + super(CloudServiceOsProfile, self).__init__(**kwargs) + self.secrets = secrets + + +class CloudServiceProperties(msrest.serialization.Model): + """Cloud service properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param package_url: Specifies a URL that refers to the location of the service package in the + Blob service. The service package URL can be Shared Access Signature (SAS) URI from any storage + account. + This is a write-only property and is not returned in GET calls. + :type package_url: str + :param configuration: Specifies the XML service configuration (.cscfg) for the cloud service. + :type configuration: str + :param configuration_url: Specifies a URL that refers to the location of the service + configuration in the Blob service. The service package URL can be Shared Access Signature + (SAS) URI from any storage account. + This is a write-only property and is not returned in GET calls. + :type configuration_url: str + :param start_cloud_service: (Optional) Indicates whether to start the cloud service immediately + after it is created. The default value is ``true``. + If false, the service model is still deployed, but the code is not run immediately. Instead, + the service is PoweredOff until you call Start, at which time the service will be started. A + deployed service still incurs charges, even if it is poweredoff. + :type start_cloud_service: bool + :param allow_model_override: (Optional) Indicates whether the role sku properties + (roleProfile.roles.sku) specified in the model/template should override the role instance count + and vm size specified in the .cscfg and .csdef respectively. + The default value is ``false``. + :type allow_model_override: bool + :param upgrade_mode: Update mode for the cloud service. Role instances are allocated to update + domains when the service is deployed. Updates can be initiated manually in each update domain + or initiated automatically in all update domains. + Possible Values are :code:`
    `:code:`
    `\ **Auto**\ :code:`
    `:code:`
    `\ + **Manual** :code:`
    `:code:`
    `\ **Simultaneous**\ :code:`
    `:code:`
    ` + If not specified, the default value is Auto. If set to Manual, PUT UpdateDomain must be called + to apply the update. If set to Auto, the update is automatically applied to each update domain + in sequence. Possible values include: "Auto", "Manual", "Simultaneous". + :type upgrade_mode: str or ~azure.mgmt.compute.v2021_03_01.models.CloudServiceUpgradeMode + :param role_profile: Describes the role profile for the cloud service. + :type role_profile: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceRoleProfile + :param os_profile: Describes the OS profile for the cloud service. + :type os_profile: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceOsProfile + :param network_profile: Network Profile for the cloud service. + :type network_profile: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceNetworkProfile + :param extension_profile: Describes a cloud service extension profile. + :type extension_profile: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceExtensionProfile + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :ivar unique_id: The unique identifier for the cloud service. + :vartype unique_id: str + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'unique_id': {'readonly': True}, + } + + _attribute_map = { + 'package_url': {'key': 'packageUrl', 'type': 'str'}, + 'configuration': {'key': 'configuration', 'type': 'str'}, + 'configuration_url': {'key': 'configurationUrl', 'type': 'str'}, + 'start_cloud_service': {'key': 'startCloudService', 'type': 'bool'}, + 'allow_model_override': {'key': 'allowModelOverride', 'type': 'bool'}, + 'upgrade_mode': {'key': 'upgradeMode', 'type': 'str'}, + 'role_profile': {'key': 'roleProfile', 'type': 'CloudServiceRoleProfile'}, + 'os_profile': {'key': 'osProfile', 'type': 'CloudServiceOsProfile'}, + 'network_profile': {'key': 'networkProfile', 'type': 'CloudServiceNetworkProfile'}, + 'extension_profile': {'key': 'extensionProfile', 'type': 'CloudServiceExtensionProfile'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'unique_id': {'key': 'uniqueId', 'type': 'str'}, + } + + def __init__( + self, + *, + package_url: Optional[str] = None, + configuration: Optional[str] = None, + configuration_url: Optional[str] = None, + start_cloud_service: Optional[bool] = None, + allow_model_override: Optional[bool] = None, + upgrade_mode: Optional[Union[str, "CloudServiceUpgradeMode"]] = None, + role_profile: Optional["CloudServiceRoleProfile"] = None, + os_profile: Optional["CloudServiceOsProfile"] = None, + network_profile: Optional["CloudServiceNetworkProfile"] = None, + extension_profile: Optional["CloudServiceExtensionProfile"] = None, + **kwargs + ): + super(CloudServiceProperties, self).__init__(**kwargs) + self.package_url = package_url + self.configuration = configuration + self.configuration_url = configuration_url + self.start_cloud_service = start_cloud_service + self.allow_model_override = allow_model_override + self.upgrade_mode = upgrade_mode + self.role_profile = role_profile + self.os_profile = os_profile + self.network_profile = network_profile + self.extension_profile = extension_profile + self.provisioning_state = None + self.unique_id = None + + +class CloudServiceRole(msrest.serialization.Model): + """Describes a role of the cloud service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :param sku: Describes the cloud service role sku. + :type sku: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceRoleSku + :param properties: + :type properties: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceRoleProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'CloudServiceRoleSku'}, + 'properties': {'key': 'properties', 'type': 'CloudServiceRoleProperties'}, + } + + def __init__( + self, + *, + sku: Optional["CloudServiceRoleSku"] = None, + properties: Optional["CloudServiceRoleProperties"] = None, + **kwargs + ): + super(CloudServiceRole, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = None + self.sku = sku + self.properties = properties + + +class CloudServiceRoleListResult(msrest.serialization.Model): + """CloudServiceRoleListResult. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.CloudServiceRole] + :param next_link: + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CloudServiceRole]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["CloudServiceRole"], + next_link: Optional[str] = None, + **kwargs + ): + super(CloudServiceRoleListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class CloudServiceRoleProfile(msrest.serialization.Model): + """Describes the role profile for the cloud service. + + :param roles: List of roles for the cloud service. + :type roles: list[~azure.mgmt.compute.v2021_03_01.models.CloudServiceRoleProfileProperties] + """ + + _attribute_map = { + 'roles': {'key': 'roles', 'type': '[CloudServiceRoleProfileProperties]'}, + } + + def __init__( + self, + *, + roles: Optional[List["CloudServiceRoleProfileProperties"]] = None, + **kwargs + ): + super(CloudServiceRoleProfile, self).__init__(**kwargs) + self.roles = roles + + +class CloudServiceRoleProfileProperties(msrest.serialization.Model): + """Describes the role properties. + + :param name: Resource name. + :type name: str + :param sku: Describes the cloud service role sku. + :type sku: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceRoleSku + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'CloudServiceRoleSku'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + sku: Optional["CloudServiceRoleSku"] = None, + **kwargs + ): + super(CloudServiceRoleProfileProperties, self).__init__(**kwargs) + self.name = name + self.sku = sku + + +class CloudServiceRoleProperties(msrest.serialization.Model): + """CloudServiceRoleProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar unique_id: Specifies the ID which uniquely identifies a cloud service role. + :vartype unique_id: str + """ + + _validation = { + 'unique_id': {'readonly': True}, + } + + _attribute_map = { + 'unique_id': {'key': 'uniqueId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudServiceRoleProperties, self).__init__(**kwargs) + self.unique_id = None + + +class CloudServiceRoleSku(msrest.serialization.Model): + """Describes the cloud service role sku. + + :param name: The sku name. NOTE: If the new SKU is not supported on the hardware the cloud + service is currently on, you need to delete and recreate the cloud service or move back to the + old sku. + :type name: str + :param tier: Specifies the tier of the cloud service. Possible Values are :code:`
    `:code:`
    ` **Standard** :code:`
    `:code:`
    ` **Basic**. + :type tier: str + :param capacity: Specifies the number of role instances in the cloud service. + :type capacity: long + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'long'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + tier: Optional[str] = None, + capacity: Optional[int] = None, + **kwargs + ): + super(CloudServiceRoleSku, self).__init__(**kwargs) + self.name = name + self.tier = tier + self.capacity = capacity + + +class CloudServiceUpdate(msrest.serialization.Model): + """CloudServiceUpdate. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(CloudServiceUpdate, self).__init__(**kwargs) + self.tags = tags + + +class CloudServiceVaultAndSecretReference(msrest.serialization.Model): + """CloudServiceVaultAndSecretReference. + + :param source_vault: + :type source_vault: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param secret_url: + :type secret_url: str + """ + + _attribute_map = { + 'source_vault': {'key': 'sourceVault', 'type': 'SubResource'}, + 'secret_url': {'key': 'secretUrl', 'type': 'str'}, + } + + def __init__( + self, + *, + source_vault: Optional["SubResource"] = None, + secret_url: Optional[str] = None, + **kwargs + ): + super(CloudServiceVaultAndSecretReference, self).__init__(**kwargs) + self.source_vault = source_vault + self.secret_url = secret_url + + +class CloudServiceVaultCertificate(msrest.serialization.Model): + """Describes a single certificate reference in a Key Vault, and where the certificate should reside on the role instance. + + :param certificate_url: This is the URL of a certificate that has been uploaded to Key Vault as + a secret. + :type certificate_url: str + """ + + _attribute_map = { + 'certificate_url': {'key': 'certificateUrl', 'type': 'str'}, + } + + def __init__( + self, + *, + certificate_url: Optional[str] = None, + **kwargs + ): + super(CloudServiceVaultCertificate, self).__init__(**kwargs) + self.certificate_url = certificate_url + + +class CloudServiceVaultSecretGroup(msrest.serialization.Model): + """Describes a set of certificates which are all in the same Key Vault. + + :param source_vault: The relative URL of the Key Vault containing all of the certificates in + VaultCertificates. + :type source_vault: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param vault_certificates: The list of key vault references in SourceVault which contain + certificates. + :type vault_certificates: + list[~azure.mgmt.compute.v2021_03_01.models.CloudServiceVaultCertificate] + """ + + _attribute_map = { + 'source_vault': {'key': 'sourceVault', 'type': 'SubResource'}, + 'vault_certificates': {'key': 'vaultCertificates', 'type': '[CloudServiceVaultCertificate]'}, + } + + def __init__( + self, + *, + source_vault: Optional["SubResource"] = None, + vault_certificates: Optional[List["CloudServiceVaultCertificate"]] = None, + **kwargs + ): + super(CloudServiceVaultSecretGroup, self).__init__(**kwargs) + self.source_vault = source_vault + self.vault_certificates = vault_certificates + + +class ComputeOperationListResult(msrest.serialization.Model): + """The List Compute Operation operation response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of compute operations. + :vartype value: list[~azure.mgmt.compute.v2021_03_01.models.ComputeOperationValue] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ComputeOperationValue]'}, + } + + def __init__( + self, + **kwargs + ): + super(ComputeOperationListResult, self).__init__(**kwargs) + self.value = None + + +class ComputeOperationValue(msrest.serialization.Model): + """Describes the properties of a Compute Operation value. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar origin: The origin of the compute operation. + :vartype origin: str + :ivar name: The name of the compute operation. + :vartype name: str + :ivar operation: The display name of the compute operation. + :vartype operation: str + :ivar resource: The display name of the resource the operation applies to. + :vartype resource: str + :ivar description: The description of the operation. + :vartype description: str + :ivar provider: The resource provider for the operation. + :vartype provider: str + """ + + _validation = { + 'origin': {'readonly': True}, + 'name': {'readonly': True}, + 'operation': {'readonly': True}, + 'resource': {'readonly': True}, + 'description': {'readonly': True}, + 'provider': {'readonly': True}, + } + + _attribute_map = { + 'origin': {'key': 'origin', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'operation': {'key': 'display.operation', 'type': 'str'}, + 'resource': {'key': 'display.resource', 'type': 'str'}, + 'description': {'key': 'display.description', 'type': 'str'}, + 'provider': {'key': 'display.provider', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ComputeOperationValue, self).__init__(**kwargs) + self.origin = None + self.name = None + self.operation = None + self.resource = None + self.description = None + self.provider = None + + +class DataDisk(msrest.serialization.Model): + """Describes a data disk. + + 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. + + :param lun: Required. Specifies the logical unit number of the data disk. This value is used to + identify data disks within the VM and therefore must be unique for each data disk attached to a + VM. + :type lun: int + :param name: The disk name. + :type name: str + :param vhd: The virtual hard disk. + :type vhd: ~azure.mgmt.compute.v2021_03_01.models.VirtualHardDisk + :param image: The source user image virtual hard disk. The virtual hard disk will be copied + before being attached to the virtual machine. If SourceImage is provided, the destination + virtual hard drive must not exist. + :type image: ~azure.mgmt.compute.v2021_03_01.models.VirtualHardDisk + :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + are: :code:`
    `:code:`
    ` **None** :code:`
    `:code:`
    ` **ReadOnly** + :code:`
    `:code:`
    ` **ReadWrite** :code:`
    `:code:`
    ` Default: **None for Standard + storage. ReadOnly for Premium storage**. Possible values include: "None", "ReadOnly", + "ReadWrite". + :type caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes + :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :type write_accelerator_enabled: bool + :param create_option: Required. Specifies how the virtual machine should be + created.:code:`
    `:code:`
    ` Possible values are::code:`
    `:code:`
    ` **Attach** \u2013 + This value is used when you are using a specialized disk to create the virtual + machine.:code:`
    `:code:`
    ` **FromImage** \u2013 This value is used when you are using an + image to create the virtual machine. If you are using a platform image, you also use the + imageReference element described above. If you are using a marketplace image, you also use the + plan element previously described. Possible values include: "FromImage", "Empty", "Attach". + :type create_option: str or ~azure.mgmt.compute.v2021_03_01.models.DiskCreateOptionTypes + :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + used to overwrite the size of the disk in a virtual machine image. :code:`
    `:code:`
    ` + This value cannot be larger than 1023 GB. + :type disk_size_gb: int + :param managed_disk: The managed disk parameters. + :type managed_disk: ~azure.mgmt.compute.v2021_03_01.models.ManagedDiskParameters + :param to_be_detached: Specifies whether the data disk is in process of detachment from the + VirtualMachine/VirtualMachineScaleset. + :type to_be_detached: bool + :ivar disk_iops_read_write: Specifies the Read-Write IOPS for the managed disk when + StorageAccountType is UltraSSD_LRS. Returned only for VirtualMachine ScaleSet VM disks. Can be + updated only via updates to the VirtualMachine Scale Set. + :vartype disk_iops_read_write: long + :ivar disk_m_bps_read_write: Specifies the bandwidth in MB per second for the managed disk when + StorageAccountType is UltraSSD_LRS. Returned only for VirtualMachine ScaleSet VM disks. Can be + updated only via updates to the VirtualMachine Scale Set. + :vartype disk_m_bps_read_write: long + :param detach_option: Specifies the detach behavior to be used while detaching a disk or which + is already in the process of detachment from the virtual machine. Supported values: + **ForceDetach**. :code:`
    `:code:`
    ` detachOption: **ForceDetach** is applicable only for + managed data disks. If a previous detachment attempt of the data disk did not complete due to + an unexpected failure from the virtual machine and the disk is still not released then use + force-detach as a last resort option to detach the disk forcibly from the VM. All writes might + not have been flushed when using this detach behavior. :code:`
    `:code:`
    ` This feature is + still in preview mode and is not supported for VirtualMachineScaleSet. To force-detach a data + disk update toBeDetached to 'true' along with setting detachOption: 'ForceDetach'. Possible + values include: "ForceDetach". + :type detach_option: str or ~azure.mgmt.compute.v2021_03_01.models.DiskDetachOptionTypes + """ + + _validation = { + 'lun': {'required': True}, + 'create_option': {'required': True}, + 'disk_iops_read_write': {'readonly': True}, + 'disk_m_bps_read_write': {'readonly': True}, + } + + _attribute_map = { + 'lun': {'key': 'lun', 'type': 'int'}, + 'name': {'key': 'name', 'type': 'str'}, + 'vhd': {'key': 'vhd', 'type': 'VirtualHardDisk'}, + 'image': {'key': 'image', 'type': 'VirtualHardDisk'}, + 'caching': {'key': 'caching', 'type': 'str'}, + 'write_accelerator_enabled': {'key': 'writeAcceleratorEnabled', 'type': 'bool'}, + 'create_option': {'key': 'createOption', 'type': 'str'}, + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, + 'managed_disk': {'key': 'managedDisk', 'type': 'ManagedDiskParameters'}, + 'to_be_detached': {'key': 'toBeDetached', 'type': 'bool'}, + 'disk_iops_read_write': {'key': 'diskIOPSReadWrite', 'type': 'long'}, + 'disk_m_bps_read_write': {'key': 'diskMBpsReadWrite', 'type': 'long'}, + 'detach_option': {'key': 'detachOption', 'type': 'str'}, + } + + def __init__( + self, + *, + lun: int, + create_option: Union[str, "DiskCreateOptionTypes"], + name: Optional[str] = None, + vhd: Optional["VirtualHardDisk"] = None, + image: Optional["VirtualHardDisk"] = None, + caching: Optional[Union[str, "CachingTypes"]] = None, + write_accelerator_enabled: Optional[bool] = None, + disk_size_gb: Optional[int] = None, + managed_disk: Optional["ManagedDiskParameters"] = None, + to_be_detached: Optional[bool] = None, + detach_option: Optional[Union[str, "DiskDetachOptionTypes"]] = None, + **kwargs + ): + super(DataDisk, self).__init__(**kwargs) + self.lun = lun + self.name = name + self.vhd = vhd + self.image = image + self.caching = caching + self.write_accelerator_enabled = write_accelerator_enabled + self.create_option = create_option + self.disk_size_gb = disk_size_gb + self.managed_disk = managed_disk + self.to_be_detached = to_be_detached + self.disk_iops_read_write = None + self.disk_m_bps_read_write = None + self.detach_option = detach_option + + +class DataDiskImage(msrest.serialization.Model): + """Contains the data disk images information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar lun: Specifies the logical unit number of the data disk. This value is used to identify + data disks within the VM and therefore must be unique for each data disk attached to a VM. + :vartype lun: int + """ + + _validation = { + 'lun': {'readonly': True}, + } + + _attribute_map = { + 'lun': {'key': 'lun', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(DataDiskImage, self).__init__(**kwargs) + self.lun = None + + +class DedicatedHost(Resource): + """Specifies information about the Dedicated host. + + 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 id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: Required. SKU of the dedicated host for Hardware Generation and VM family. Only + name is required to be set. List Microsoft.Compute SKUs for a list of possible values. + :type sku: ~azure.mgmt.compute.v2021_03_01.models.Sku + :param platform_fault_domain: Fault domain of the dedicated host within a dedicated host group. + :type platform_fault_domain: int + :param auto_replace_on_failure: Specifies whether the dedicated host should be replaced + automatically in case of a failure. The value is defaulted to 'true' when not provided. + :type auto_replace_on_failure: bool + :ivar host_id: A unique id generated and assigned to the dedicated host by the platform. + :code:`
    `:code:`
    ` Does not change throughout the lifetime of the host. + :vartype host_id: str + :ivar virtual_machines: A list of references to all virtual machines in the Dedicated Host. + :vartype virtual_machines: list[~azure.mgmt.compute.v2021_03_01.models.SubResourceReadOnly] + :param license_type: Specifies the software license type that will be applied to the VMs + deployed on the dedicated host. :code:`
    `:code:`
    ` Possible values are: + :code:`
    `:code:`
    ` **None** :code:`
    `:code:`
    ` **Windows_Server_Hybrid** + :code:`
    `:code:`
    ` **Windows_Server_Perpetual** :code:`
    `:code:`
    ` Default: + **None**. Possible values include: "None", "Windows_Server_Hybrid", "Windows_Server_Perpetual". + :type license_type: str or ~azure.mgmt.compute.v2021_03_01.models.DedicatedHostLicenseTypes + :ivar provisioning_time: The date when the host was first provisioned. + :vartype provisioning_time: ~datetime.datetime + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :ivar instance_view: The dedicated host instance view. + :vartype instance_view: ~azure.mgmt.compute.v2021_03_01.models.DedicatedHostInstanceView + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'sku': {'required': True}, + 'platform_fault_domain': {'minimum': 0}, + 'host_id': {'readonly': True}, + 'virtual_machines': {'readonly': True}, + 'provisioning_time': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'instance_view': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'platform_fault_domain': {'key': 'properties.platformFaultDomain', 'type': 'int'}, + 'auto_replace_on_failure': {'key': 'properties.autoReplaceOnFailure', 'type': 'bool'}, + 'host_id': {'key': 'properties.hostId', 'type': 'str'}, + 'virtual_machines': {'key': 'properties.virtualMachines', 'type': '[SubResourceReadOnly]'}, + 'license_type': {'key': 'properties.licenseType', 'type': 'str'}, + 'provisioning_time': {'key': 'properties.provisioningTime', 'type': 'iso-8601'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'instance_view': {'key': 'properties.instanceView', 'type': 'DedicatedHostInstanceView'}, + } + + def __init__( + self, + *, + location: str, + sku: "Sku", + tags: Optional[Dict[str, str]] = None, + platform_fault_domain: Optional[int] = None, + auto_replace_on_failure: Optional[bool] = None, + license_type: Optional[Union[str, "DedicatedHostLicenseTypes"]] = None, + **kwargs + ): + super(DedicatedHost, self).__init__(location=location, tags=tags, **kwargs) + self.sku = sku + self.platform_fault_domain = platform_fault_domain + self.auto_replace_on_failure = auto_replace_on_failure + self.host_id = None + self.virtual_machines = None + self.license_type = license_type + self.provisioning_time = None + self.provisioning_state = None + self.instance_view = None + + +class DedicatedHostAllocatableVM(msrest.serialization.Model): + """Represents the dedicated host unutilized capacity in terms of a specific VM size. + + :param vm_size: VM size in terms of which the unutilized capacity is represented. + :type vm_size: str + :param count: Maximum number of VMs of size vmSize that can fit in the dedicated host's + remaining capacity. + :type count: float + """ + + _attribute_map = { + 'vm_size': {'key': 'vmSize', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'float'}, + } + + def __init__( + self, + *, + vm_size: Optional[str] = None, + count: Optional[float] = None, + **kwargs + ): + super(DedicatedHostAllocatableVM, self).__init__(**kwargs) + self.vm_size = vm_size + self.count = count + + +class DedicatedHostAvailableCapacity(msrest.serialization.Model): + """Dedicated host unutilized capacity. + + :param allocatable_v_ms: The unutilized capacity of the dedicated host represented in terms of + each VM size that is allowed to be deployed to the dedicated host. + :type allocatable_v_ms: list[~azure.mgmt.compute.v2021_03_01.models.DedicatedHostAllocatableVM] + """ + + _attribute_map = { + 'allocatable_v_ms': {'key': 'allocatableVMs', 'type': '[DedicatedHostAllocatableVM]'}, + } + + def __init__( + self, + *, + allocatable_v_ms: Optional[List["DedicatedHostAllocatableVM"]] = None, + **kwargs + ): + super(DedicatedHostAvailableCapacity, self).__init__(**kwargs) + self.allocatable_v_ms = allocatable_v_ms + + +class DedicatedHostGroup(Resource): + """Specifies information about the dedicated host group that the dedicated hosts should be assigned to. :code:`
    `:code:`
    ` Currently, a dedicated host can only be added to a dedicated host group at creation time. An existing dedicated host cannot be added to another dedicated host group. + + 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 id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param zones: Availability Zone to use for this host group. Only single zone is supported. The + zone can be assigned only during creation. If not provided, the group supports all zones in the + region. If provided, enforces each host in the group to be in the same zone. + :type zones: list[str] + :param platform_fault_domain_count: Number of fault domains that the host group can span. + :type platform_fault_domain_count: int + :ivar hosts: A list of references to all dedicated hosts in the dedicated host group. + :vartype hosts: list[~azure.mgmt.compute.v2021_03_01.models.SubResourceReadOnly] + :ivar instance_view: The dedicated host group instance view, which has the list of instance + view of the dedicated hosts under the dedicated host group. + :vartype instance_view: ~azure.mgmt.compute.v2021_03_01.models.DedicatedHostGroupInstanceView + :param support_automatic_placement: Specifies whether virtual machines or virtual machine scale + sets can be placed automatically on the dedicated host group. Automatic placement means + resources are allocated on dedicated hosts, that are chosen by Azure, under the dedicated host + group. The value is defaulted to 'false' when not provided. :code:`
    `:code:`
    `Minimum + api-version: 2020-06-01. + :type support_automatic_placement: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'platform_fault_domain_count': {'minimum': 1}, + 'hosts': {'readonly': True}, + 'instance_view': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'zones': {'key': 'zones', 'type': '[str]'}, + 'platform_fault_domain_count': {'key': 'properties.platformFaultDomainCount', 'type': 'int'}, + 'hosts': {'key': 'properties.hosts', 'type': '[SubResourceReadOnly]'}, + 'instance_view': {'key': 'properties.instanceView', 'type': 'DedicatedHostGroupInstanceView'}, + 'support_automatic_placement': {'key': 'properties.supportAutomaticPlacement', 'type': 'bool'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + zones: Optional[List[str]] = None, + platform_fault_domain_count: Optional[int] = None, + support_automatic_placement: Optional[bool] = None, + **kwargs + ): + super(DedicatedHostGroup, self).__init__(location=location, tags=tags, **kwargs) + self.zones = zones + self.platform_fault_domain_count = platform_fault_domain_count + self.hosts = None + self.instance_view = None + self.support_automatic_placement = support_automatic_placement + + +class DedicatedHostGroupInstanceView(msrest.serialization.Model): + """DedicatedHostGroupInstanceView. + + :param hosts: List of instance view of the dedicated hosts under the dedicated host group. + :type hosts: list[~azure.mgmt.compute.v2021_03_01.models.DedicatedHostInstanceViewWithName] + """ + + _attribute_map = { + 'hosts': {'key': 'hosts', 'type': '[DedicatedHostInstanceViewWithName]'}, + } + + def __init__( + self, + *, + hosts: Optional[List["DedicatedHostInstanceViewWithName"]] = None, + **kwargs + ): + super(DedicatedHostGroupInstanceView, self).__init__(**kwargs) + self.hosts = hosts + + +class DedicatedHostGroupListResult(msrest.serialization.Model): + """The List Dedicated Host Group with resource group response. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. The list of dedicated host groups. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.DedicatedHostGroup] + :param next_link: The URI to fetch the next page of Dedicated Host Groups. Call ListNext() with + this URI to fetch the next page of Dedicated Host Groups. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DedicatedHostGroup]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["DedicatedHostGroup"], + next_link: Optional[str] = None, + **kwargs + ): + super(DedicatedHostGroupListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class DedicatedHostGroupUpdate(UpdateResource): + """Specifies information about the dedicated host group that the dedicated host should be assigned to. Only tags may be updated. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param zones: Availability Zone to use for this host group. Only single zone is supported. The + zone can be assigned only during creation. If not provided, the group supports all zones in the + region. If provided, enforces each host in the group to be in the same zone. + :type zones: list[str] + :param platform_fault_domain_count: Number of fault domains that the host group can span. + :type platform_fault_domain_count: int + :ivar hosts: A list of references to all dedicated hosts in the dedicated host group. + :vartype hosts: list[~azure.mgmt.compute.v2021_03_01.models.SubResourceReadOnly] + :ivar instance_view: The dedicated host group instance view, which has the list of instance + view of the dedicated hosts under the dedicated host group. + :vartype instance_view: ~azure.mgmt.compute.v2021_03_01.models.DedicatedHostGroupInstanceView + :param support_automatic_placement: Specifies whether virtual machines or virtual machine scale + sets can be placed automatically on the dedicated host group. Automatic placement means + resources are allocated on dedicated hosts, that are chosen by Azure, under the dedicated host + group. The value is defaulted to 'false' when not provided. :code:`
    `:code:`
    `Minimum + api-version: 2020-06-01. + :type support_automatic_placement: bool + """ + + _validation = { + 'platform_fault_domain_count': {'minimum': 1}, + 'hosts': {'readonly': True}, + 'instance_view': {'readonly': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'zones': {'key': 'zones', 'type': '[str]'}, + 'platform_fault_domain_count': {'key': 'properties.platformFaultDomainCount', 'type': 'int'}, + 'hosts': {'key': 'properties.hosts', 'type': '[SubResourceReadOnly]'}, + 'instance_view': {'key': 'properties.instanceView', 'type': 'DedicatedHostGroupInstanceView'}, + 'support_automatic_placement': {'key': 'properties.supportAutomaticPlacement', 'type': 'bool'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + zones: Optional[List[str]] = None, + platform_fault_domain_count: Optional[int] = None, + support_automatic_placement: Optional[bool] = None, + **kwargs + ): + super(DedicatedHostGroupUpdate, self).__init__(tags=tags, **kwargs) + self.zones = zones + self.platform_fault_domain_count = platform_fault_domain_count + self.hosts = None + self.instance_view = None + self.support_automatic_placement = support_automatic_placement + + +class DedicatedHostInstanceView(msrest.serialization.Model): + """The instance view of a dedicated host. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar asset_id: Specifies the unique id of the dedicated physical machine on which the + dedicated host resides. + :vartype asset_id: str + :param available_capacity: Unutilized capacity of the dedicated host. + :type available_capacity: ~azure.mgmt.compute.v2021_03_01.models.DedicatedHostAvailableCapacity + :param statuses: The resource status information. + :type statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + """ + + _validation = { + 'asset_id': {'readonly': True}, + } + + _attribute_map = { + 'asset_id': {'key': 'assetId', 'type': 'str'}, + 'available_capacity': {'key': 'availableCapacity', 'type': 'DedicatedHostAvailableCapacity'}, + 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, + } + + def __init__( + self, + *, + available_capacity: Optional["DedicatedHostAvailableCapacity"] = None, + statuses: Optional[List["InstanceViewStatus"]] = None, + **kwargs + ): + super(DedicatedHostInstanceView, self).__init__(**kwargs) + self.asset_id = None + self.available_capacity = available_capacity + self.statuses = statuses + + +class DedicatedHostInstanceViewWithName(DedicatedHostInstanceView): + """The instance view of a dedicated host that includes the name of the dedicated host. It is used for the response to the instance view of a dedicated host group. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar asset_id: Specifies the unique id of the dedicated physical machine on which the + dedicated host resides. + :vartype asset_id: str + :param available_capacity: Unutilized capacity of the dedicated host. + :type available_capacity: ~azure.mgmt.compute.v2021_03_01.models.DedicatedHostAvailableCapacity + :param statuses: The resource status information. + :type statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + :ivar name: The name of the dedicated host. + :vartype name: str + """ + + _validation = { + 'asset_id': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'asset_id': {'key': 'assetId', 'type': 'str'}, + 'available_capacity': {'key': 'availableCapacity', 'type': 'DedicatedHostAvailableCapacity'}, + 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + available_capacity: Optional["DedicatedHostAvailableCapacity"] = None, + statuses: Optional[List["InstanceViewStatus"]] = None, + **kwargs + ): + super(DedicatedHostInstanceViewWithName, self).__init__(available_capacity=available_capacity, statuses=statuses, **kwargs) + self.name = None + + +class DedicatedHostListResult(msrest.serialization.Model): + """The list dedicated host operation response. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. The list of dedicated hosts. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.DedicatedHost] + :param next_link: The URI to fetch the next page of dedicated hosts. Call ListNext() with this + URI to fetch the next page of dedicated hosts. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DedicatedHost]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["DedicatedHost"], + next_link: Optional[str] = None, + **kwargs + ): + super(DedicatedHostListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class DedicatedHostUpdate(UpdateResource): + """Specifies information about the dedicated host. Only tags, autoReplaceOnFailure and licenseType may be updated. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param platform_fault_domain: Fault domain of the dedicated host within a dedicated host group. + :type platform_fault_domain: int + :param auto_replace_on_failure: Specifies whether the dedicated host should be replaced + automatically in case of a failure. The value is defaulted to 'true' when not provided. + :type auto_replace_on_failure: bool + :ivar host_id: A unique id generated and assigned to the dedicated host by the platform. + :code:`
    `:code:`
    ` Does not change throughout the lifetime of the host. + :vartype host_id: str + :ivar virtual_machines: A list of references to all virtual machines in the Dedicated Host. + :vartype virtual_machines: list[~azure.mgmt.compute.v2021_03_01.models.SubResourceReadOnly] + :param license_type: Specifies the software license type that will be applied to the VMs + deployed on the dedicated host. :code:`
    `:code:`
    ` Possible values are: + :code:`
    `:code:`
    ` **None** :code:`
    `:code:`
    ` **Windows_Server_Hybrid** + :code:`
    `:code:`
    ` **Windows_Server_Perpetual** :code:`
    `:code:`
    ` Default: + **None**. Possible values include: "None", "Windows_Server_Hybrid", "Windows_Server_Perpetual". + :type license_type: str or ~azure.mgmt.compute.v2021_03_01.models.DedicatedHostLicenseTypes + :ivar provisioning_time: The date when the host was first provisioned. + :vartype provisioning_time: ~datetime.datetime + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :ivar instance_view: The dedicated host instance view. + :vartype instance_view: ~azure.mgmt.compute.v2021_03_01.models.DedicatedHostInstanceView + """ + + _validation = { + 'platform_fault_domain': {'minimum': 0}, + 'host_id': {'readonly': True}, + 'virtual_machines': {'readonly': True}, + 'provisioning_time': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'instance_view': {'readonly': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'platform_fault_domain': {'key': 'properties.platformFaultDomain', 'type': 'int'}, + 'auto_replace_on_failure': {'key': 'properties.autoReplaceOnFailure', 'type': 'bool'}, + 'host_id': {'key': 'properties.hostId', 'type': 'str'}, + 'virtual_machines': {'key': 'properties.virtualMachines', 'type': '[SubResourceReadOnly]'}, + 'license_type': {'key': 'properties.licenseType', 'type': 'str'}, + 'provisioning_time': {'key': 'properties.provisioningTime', 'type': 'iso-8601'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'instance_view': {'key': 'properties.instanceView', 'type': 'DedicatedHostInstanceView'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + platform_fault_domain: Optional[int] = None, + auto_replace_on_failure: Optional[bool] = None, + license_type: Optional[Union[str, "DedicatedHostLicenseTypes"]] = None, + **kwargs + ): + super(DedicatedHostUpdate, self).__init__(tags=tags, **kwargs) + self.platform_fault_domain = platform_fault_domain + self.auto_replace_on_failure = auto_replace_on_failure + self.host_id = None + self.virtual_machines = None + self.license_type = license_type + self.provisioning_time = None + self.provisioning_state = None + self.instance_view = None + + +class DiagnosticsProfile(msrest.serialization.Model): + """Specifies the boot diagnostic settings state. :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + + :param boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + Console Output and Screenshot to diagnose VM status. :code:`
    `:code:`
    ` You can easily + view the output of your console log. :code:`
    `:code:`
    ` Azure also enables you to see a + screenshot of the VM from the hypervisor. + :type boot_diagnostics: ~azure.mgmt.compute.v2021_03_01.models.BootDiagnostics + """ + + _attribute_map = { + 'boot_diagnostics': {'key': 'bootDiagnostics', 'type': 'BootDiagnostics'}, + } + + def __init__( + self, + *, + boot_diagnostics: Optional["BootDiagnostics"] = None, + **kwargs + ): + super(DiagnosticsProfile, self).__init__(**kwargs) + self.boot_diagnostics = boot_diagnostics + + +class DiffDiskSettings(msrest.serialization.Model): + """Describes the parameters of ephemeral disk settings that can be specified for operating system disk. :code:`
    `:code:`
    ` NOTE: The ephemeral disk settings can only be specified for managed disk. + + :param option: Specifies the ephemeral disk settings for operating system disk. Possible values + include: "Local". + :type option: str or ~azure.mgmt.compute.v2021_03_01.models.DiffDiskOptions + :param placement: Specifies the ephemeral disk placement for operating system + disk.:code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` **CacheDisk** + :code:`
    `:code:`
    ` **ResourceDisk** :code:`
    `:code:`
    ` Default: **CacheDisk** if + one is configured for the VM size otherwise **ResourceDisk** is used.:code:`
    `:code:`
    ` + Refer to VM size documentation for Windows VM at https://docs.microsoft.com/en- + us/azure/virtual-machines/windows/sizes and Linux VM at https://docs.microsoft.com/en- + us/azure/virtual-machines/linux/sizes to check which VM sizes exposes a cache disk. Possible + values include: "CacheDisk", "ResourceDisk". + :type placement: str or ~azure.mgmt.compute.v2021_03_01.models.DiffDiskPlacement + """ + + _attribute_map = { + 'option': {'key': 'option', 'type': 'str'}, + 'placement': {'key': 'placement', 'type': 'str'}, + } + + def __init__( + self, + *, + option: Optional[Union[str, "DiffDiskOptions"]] = None, + placement: Optional[Union[str, "DiffDiskPlacement"]] = None, + **kwargs + ): + super(DiffDiskSettings, self).__init__(**kwargs) + self.option = option + self.placement = placement + + +class DisallowedConfiguration(msrest.serialization.Model): + """Specifies the disallowed configuration for a virtual machine image. + + :param vm_disk_type: VM disk types which are disallowed. Possible values include: "None", + "Unmanaged". + :type vm_disk_type: str or ~azure.mgmt.compute.v2021_03_01.models.VmDiskTypes + """ + + _attribute_map = { + 'vm_disk_type': {'key': 'vmDiskType', 'type': 'str'}, + } + + def __init__( + self, + *, + vm_disk_type: Optional[Union[str, "VmDiskTypes"]] = None, + **kwargs + ): + super(DisallowedConfiguration, self).__init__(**kwargs) + self.vm_disk_type = vm_disk_type + + +class SubResource(msrest.serialization.Model): + """SubResource. + + :param id: Resource Id. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + super(SubResource, self).__init__(**kwargs) + self.id = id + + +class DiskEncryptionSetParameters(SubResource): + """Describes the parameter of customer managed disk encryption set resource id that can be specified for disk. :code:`
    `:code:`
    ` NOTE: The disk encryption set resource id can only be specified for managed disk. Please refer https://aka.ms/mdssewithcmkoverview for more details. + + :param id: Resource Id. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + super(DiskEncryptionSetParameters, self).__init__(id=id, **kwargs) + + +class DiskEncryptionSettings(msrest.serialization.Model): + """Describes a Encryption Settings for a Disk. + + :param disk_encryption_key: Specifies the location of the disk encryption key, which is a Key + Vault Secret. + :type disk_encryption_key: ~azure.mgmt.compute.v2021_03_01.models.KeyVaultSecretReference + :param key_encryption_key: Specifies the location of the key encryption key in Key Vault. + :type key_encryption_key: ~azure.mgmt.compute.v2021_03_01.models.KeyVaultKeyReference + :param enabled: Specifies whether disk encryption should be enabled on the virtual machine. + :type enabled: bool + """ + + _attribute_map = { + 'disk_encryption_key': {'key': 'diskEncryptionKey', 'type': 'KeyVaultSecretReference'}, + 'key_encryption_key': {'key': 'keyEncryptionKey', 'type': 'KeyVaultKeyReference'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + disk_encryption_key: Optional["KeyVaultSecretReference"] = None, + key_encryption_key: Optional["KeyVaultKeyReference"] = None, + enabled: Optional[bool] = None, + **kwargs + ): + super(DiskEncryptionSettings, self).__init__(**kwargs) + self.disk_encryption_key = disk_encryption_key + self.key_encryption_key = key_encryption_key + self.enabled = enabled + + +class DiskInstanceView(msrest.serialization.Model): + """The instance view of the disk. + + :param name: The disk name. + :type name: str + :param encryption_settings: Specifies the encryption settings for the OS Disk. + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :type encryption_settings: list[~azure.mgmt.compute.v2021_03_01.models.DiskEncryptionSettings] + :param statuses: The resource status information. + :type statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'encryption_settings': {'key': 'encryptionSettings', 'type': '[DiskEncryptionSettings]'}, + 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + encryption_settings: Optional[List["DiskEncryptionSettings"]] = None, + statuses: Optional[List["InstanceViewStatus"]] = None, + **kwargs + ): + super(DiskInstanceView, self).__init__(**kwargs) + self.name = name + self.encryption_settings = encryption_settings + self.statuses = statuses + + +class ExtendedLocation(msrest.serialization.Model): + """The complex type of the extended location. + + :param name: The name of the extended location. + :type name: str + :param type: The type of the extended location. Possible values include: "EdgeZone". + :type type: str or ~azure.mgmt.compute.v2021_03_01.models.ExtendedLocationTypes + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[Union[str, "ExtendedLocationTypes"]] = None, + **kwargs + ): + super(ExtendedLocation, self).__init__(**kwargs) + self.name = name + self.type = type + + +class Extension(msrest.serialization.Model): + """Describes a cloud service Extension. + + :param name: The name of the extension. + :type name: str + :param properties: Extension Properties. + :type properties: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceExtensionProperties + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'CloudServiceExtensionProperties'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + properties: Optional["CloudServiceExtensionProperties"] = None, + **kwargs + ): + super(Extension, self).__init__(**kwargs) + self.name = name + self.properties = properties + + +class HardwareProfile(msrest.serialization.Model): + """Specifies the hardware settings for the virtual machine. + + :param vm_size: Specifies the size of the virtual machine. :code:`
    `:code:`
    ` The enum + data type is currently deprecated and will be removed by December 23rd 2023. + :code:`
    `:code:`
    ` Recommended way to get the list of available sizes is using these + APIs: :code:`
    `:code:`
    ` `List all available virtual machine sizes in an availability set + `_ + :code:`
    `:code:`
    ` `List all available virtual machine sizes in a region + `_ + :code:`
    `:code:`
    ` `List all available virtual machine sizes for resizing + `_. For more + information about virtual machine sizes, see `Sizes for virtual machines + `_. :code:`
    `:code:`
    ` The + available VM sizes depend on region and availability set. Possible values include: "Basic_A0", + "Basic_A1", "Basic_A2", "Basic_A3", "Basic_A4", "Standard_A0", "Standard_A1", "Standard_A2", + "Standard_A3", "Standard_A4", "Standard_A5", "Standard_A6", "Standard_A7", "Standard_A8", + "Standard_A9", "Standard_A10", "Standard_A11", "Standard_A1_v2", "Standard_A2_v2", + "Standard_A4_v2", "Standard_A8_v2", "Standard_A2m_v2", "Standard_A4m_v2", "Standard_A8m_v2", + "Standard_B1s", "Standard_B1ms", "Standard_B2s", "Standard_B2ms", "Standard_B4ms", + "Standard_B8ms", "Standard_D1", "Standard_D2", "Standard_D3", "Standard_D4", "Standard_D11", + "Standard_D12", "Standard_D13", "Standard_D14", "Standard_D1_v2", "Standard_D2_v2", + "Standard_D3_v2", "Standard_D4_v2", "Standard_D5_v2", "Standard_D2_v3", "Standard_D4_v3", + "Standard_D8_v3", "Standard_D16_v3", "Standard_D32_v3", "Standard_D64_v3", "Standard_D2s_v3", + "Standard_D4s_v3", "Standard_D8s_v3", "Standard_D16s_v3", "Standard_D32s_v3", + "Standard_D64s_v3", "Standard_D11_v2", "Standard_D12_v2", "Standard_D13_v2", "Standard_D14_v2", + "Standard_D15_v2", "Standard_DS1", "Standard_DS2", "Standard_DS3", "Standard_DS4", + "Standard_DS11", "Standard_DS12", "Standard_DS13", "Standard_DS14", "Standard_DS1_v2", + "Standard_DS2_v2", "Standard_DS3_v2", "Standard_DS4_v2", "Standard_DS5_v2", "Standard_DS11_v2", + "Standard_DS12_v2", "Standard_DS13_v2", "Standard_DS14_v2", "Standard_DS15_v2", + "Standard_DS13-4_v2", "Standard_DS13-2_v2", "Standard_DS14-8_v2", "Standard_DS14-4_v2", + "Standard_E2_v3", "Standard_E4_v3", "Standard_E8_v3", "Standard_E16_v3", "Standard_E32_v3", + "Standard_E64_v3", "Standard_E2s_v3", "Standard_E4s_v3", "Standard_E8s_v3", "Standard_E16s_v3", + "Standard_E32s_v3", "Standard_E64s_v3", "Standard_E32-16_v3", "Standard_E32-8s_v3", + "Standard_E64-32s_v3", "Standard_E64-16s_v3", "Standard_F1", "Standard_F2", "Standard_F4", + "Standard_F8", "Standard_F16", "Standard_F1s", "Standard_F2s", "Standard_F4s", "Standard_F8s", + "Standard_F16s", "Standard_F2s_v2", "Standard_F4s_v2", "Standard_F8s_v2", "Standard_F16s_v2", + "Standard_F32s_v2", "Standard_F64s_v2", "Standard_F72s_v2", "Standard_G1", "Standard_G2", + "Standard_G3", "Standard_G4", "Standard_G5", "Standard_GS1", "Standard_GS2", "Standard_GS3", + "Standard_GS4", "Standard_GS5", "Standard_GS4-8", "Standard_GS4-4", "Standard_GS5-16", + "Standard_GS5-8", "Standard_H8", "Standard_H16", "Standard_H8m", "Standard_H16m", + "Standard_H16r", "Standard_H16mr", "Standard_L4s", "Standard_L8s", "Standard_L16s", + "Standard_L32s", "Standard_M64s", "Standard_M64ms", "Standard_M128s", "Standard_M128ms", + "Standard_M64-32ms", "Standard_M64-16ms", "Standard_M128-64ms", "Standard_M128-32ms", + "Standard_NC6", "Standard_NC12", "Standard_NC24", "Standard_NC24r", "Standard_NC6s_v2", + "Standard_NC12s_v2", "Standard_NC24s_v2", "Standard_NC24rs_v2", "Standard_NC6s_v3", + "Standard_NC12s_v3", "Standard_NC24s_v3", "Standard_NC24rs_v3", "Standard_ND6s", + "Standard_ND12s", "Standard_ND24s", "Standard_ND24rs", "Standard_NV6", "Standard_NV12", + "Standard_NV24". + :type vm_size: str or ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineSizeTypes + """ + + _attribute_map = { + 'vm_size': {'key': 'vmSize', 'type': 'str'}, + } + + def __init__( + self, + *, + vm_size: Optional[Union[str, "VirtualMachineSizeTypes"]] = None, + **kwargs + ): + super(HardwareProfile, self).__init__(**kwargs) + self.vm_size = vm_size + + +class Image(Resource): + """The source user image virtual hard disk. The virtual hard disk will be copied before being attached to the virtual machine. If SourceImage is provided, the destination virtual hard drive must not exist. + + 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 id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param extended_location: The extended location of the Image. + :type extended_location: ~azure.mgmt.compute.v2021_03_01.models.ExtendedLocation + :param source_virtual_machine: The source virtual machine from which Image is created. + :type source_virtual_machine: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param storage_profile: Specifies the storage settings for the virtual machine disks. + :type storage_profile: ~azure.mgmt.compute.v2021_03_01.models.ImageStorageProfile + :ivar provisioning_state: The provisioning state. + :vartype provisioning_state: str + :param hyper_v_generation: Specifies the HyperVGenerationType of the VirtualMachine created + from the image. From API Version 2019-03-01 if the image source is a blob, then we need the + user to specify the value, if the source is managed resource like disk or snapshot, we may + require the user to specify the property if we cannot deduce it from the source managed + resource. Possible values include: "V1", "V2". + :type hyper_v_generation: str or ~azure.mgmt.compute.v2021_03_01.models.HyperVGenerationTypes + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, + 'source_virtual_machine': {'key': 'properties.sourceVirtualMachine', 'type': 'SubResource'}, + 'storage_profile': {'key': 'properties.storageProfile', 'type': 'ImageStorageProfile'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + extended_location: Optional["ExtendedLocation"] = None, + source_virtual_machine: Optional["SubResource"] = None, + storage_profile: Optional["ImageStorageProfile"] = None, + hyper_v_generation: Optional[Union[str, "HyperVGenerationTypes"]] = None, + **kwargs + ): + super(Image, self).__init__(location=location, tags=tags, **kwargs) + self.extended_location = extended_location + self.source_virtual_machine = source_virtual_machine + self.storage_profile = storage_profile + self.provisioning_state = None + self.hyper_v_generation = hyper_v_generation + + +class ImageDisk(msrest.serialization.Model): + """Describes a image disk. + + :param snapshot: The snapshot. + :type snapshot: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param managed_disk: The managedDisk. + :type managed_disk: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param blob_uri: The Virtual Hard Disk. + :type blob_uri: str + :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + are: :code:`
    `:code:`
    ` **None** :code:`
    `:code:`
    ` **ReadOnly** + :code:`
    `:code:`
    ` **ReadWrite** :code:`
    `:code:`
    ` Default: **None for Standard + storage. ReadOnly for Premium storage**. Possible values include: "None", "ReadOnly", + "ReadWrite". + :type caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes + :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + used to overwrite the name of the disk in a virtual machine image. :code:`
    `:code:`
    ` + This value cannot be larger than 1023 GB. + :type disk_size_gb: int + :param storage_account_type: Specifies the storage account type for the managed disk. NOTE: + UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. Possible values + include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", + "StandardSSD_ZRS". + :type storage_account_type: str or ~azure.mgmt.compute.v2021_03_01.models.StorageAccountTypes + :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + the managed image disk. + :type disk_encryption_set: ~azure.mgmt.compute.v2021_03_01.models.DiskEncryptionSetParameters + """ + + _attribute_map = { + 'snapshot': {'key': 'snapshot', 'type': 'SubResource'}, + 'managed_disk': {'key': 'managedDisk', 'type': 'SubResource'}, + 'blob_uri': {'key': 'blobUri', 'type': 'str'}, + 'caching': {'key': 'caching', 'type': 'str'}, + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, + 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, + 'disk_encryption_set': {'key': 'diskEncryptionSet', 'type': 'DiskEncryptionSetParameters'}, + } + + def __init__( + self, + *, + snapshot: Optional["SubResource"] = None, + managed_disk: Optional["SubResource"] = None, + blob_uri: Optional[str] = None, + caching: Optional[Union[str, "CachingTypes"]] = None, + disk_size_gb: Optional[int] = None, + storage_account_type: Optional[Union[str, "StorageAccountTypes"]] = None, + disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, + **kwargs + ): + super(ImageDisk, self).__init__(**kwargs) + self.snapshot = snapshot + self.managed_disk = managed_disk + self.blob_uri = blob_uri + self.caching = caching + self.disk_size_gb = disk_size_gb + self.storage_account_type = storage_account_type + self.disk_encryption_set = disk_encryption_set + + +class ImageDataDisk(ImageDisk): + """Describes a data disk. + + All required parameters must be populated in order to send to Azure. + + :param snapshot: The snapshot. + :type snapshot: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param managed_disk: The managedDisk. + :type managed_disk: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param blob_uri: The Virtual Hard Disk. + :type blob_uri: str + :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + are: :code:`
    `:code:`
    ` **None** :code:`
    `:code:`
    ` **ReadOnly** + :code:`
    `:code:`
    ` **ReadWrite** :code:`
    `:code:`
    ` Default: **None for Standard + storage. ReadOnly for Premium storage**. Possible values include: "None", "ReadOnly", + "ReadWrite". + :type caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes + :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + used to overwrite the name of the disk in a virtual machine image. :code:`
    `:code:`
    ` + This value cannot be larger than 1023 GB. + :type disk_size_gb: int + :param storage_account_type: Specifies the storage account type for the managed disk. NOTE: + UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. Possible values + include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", + "StandardSSD_ZRS". + :type storage_account_type: str or ~azure.mgmt.compute.v2021_03_01.models.StorageAccountTypes + :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + the managed image disk. + :type disk_encryption_set: ~azure.mgmt.compute.v2021_03_01.models.DiskEncryptionSetParameters + :param lun: Required. Specifies the logical unit number of the data disk. This value is used to + identify data disks within the VM and therefore must be unique for each data disk attached to a + VM. + :type lun: int + """ + + _validation = { + 'lun': {'required': True}, + } + + _attribute_map = { + 'snapshot': {'key': 'snapshot', 'type': 'SubResource'}, + 'managed_disk': {'key': 'managedDisk', 'type': 'SubResource'}, + 'blob_uri': {'key': 'blobUri', 'type': 'str'}, + 'caching': {'key': 'caching', 'type': 'str'}, + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, + 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, + 'disk_encryption_set': {'key': 'diskEncryptionSet', 'type': 'DiskEncryptionSetParameters'}, + 'lun': {'key': 'lun', 'type': 'int'}, + } + + def __init__( + self, + *, + lun: int, + snapshot: Optional["SubResource"] = None, + managed_disk: Optional["SubResource"] = None, + blob_uri: Optional[str] = None, + caching: Optional[Union[str, "CachingTypes"]] = None, + disk_size_gb: Optional[int] = None, + storage_account_type: Optional[Union[str, "StorageAccountTypes"]] = None, + disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, + **kwargs + ): + super(ImageDataDisk, self).__init__(snapshot=snapshot, managed_disk=managed_disk, blob_uri=blob_uri, caching=caching, disk_size_gb=disk_size_gb, storage_account_type=storage_account_type, disk_encryption_set=disk_encryption_set, **kwargs) + self.lun = lun + + +class ImageListResult(msrest.serialization.Model): + """The List Image operation response. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. The list of Images. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.Image] + :param next_link: The uri to fetch the next page of Images. Call ListNext() with this to fetch + the next page of Images. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Image]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["Image"], + next_link: Optional[str] = None, + **kwargs + ): + super(ImageListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ImageOSDisk(ImageDisk): + """Describes an Operating System disk. + + All required parameters must be populated in order to send to Azure. + + :param snapshot: The snapshot. + :type snapshot: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param managed_disk: The managedDisk. + :type managed_disk: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param blob_uri: The Virtual Hard Disk. + :type blob_uri: str + :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + are: :code:`
    `:code:`
    ` **None** :code:`
    `:code:`
    ` **ReadOnly** + :code:`
    `:code:`
    ` **ReadWrite** :code:`
    `:code:`
    ` Default: **None for Standard + storage. ReadOnly for Premium storage**. Possible values include: "None", "ReadOnly", + "ReadWrite". + :type caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes + :param disk_size_gb: Specifies the size of empty data disks in gigabytes. This element can be + used to overwrite the name of the disk in a virtual machine image. :code:`
    `:code:`
    ` + This value cannot be larger than 1023 GB. + :type disk_size_gb: int + :param storage_account_type: Specifies the storage account type for the managed disk. NOTE: + UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. Possible values + include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", + "StandardSSD_ZRS". + :type storage_account_type: str or ~azure.mgmt.compute.v2021_03_01.models.StorageAccountTypes + :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + the managed image disk. + :type disk_encryption_set: ~azure.mgmt.compute.v2021_03_01.models.DiskEncryptionSetParameters + :param os_type: Required. This property allows you to specify the type of the OS that is + included in the disk if creating a VM from a custom image. :code:`
    `:code:`
    ` Possible + values are: :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible + values include: "Windows", "Linux". + :type os_type: str or ~azure.mgmt.compute.v2021_03_01.models.OperatingSystemTypes + :param os_state: Required. The OS State. Possible values include: "Generalized", "Specialized". + :type os_state: str or ~azure.mgmt.compute.v2021_03_01.models.OperatingSystemStateTypes + """ + + _validation = { + 'os_type': {'required': True}, + 'os_state': {'required': True}, + } + + _attribute_map = { + 'snapshot': {'key': 'snapshot', 'type': 'SubResource'}, + 'managed_disk': {'key': 'managedDisk', 'type': 'SubResource'}, + 'blob_uri': {'key': 'blobUri', 'type': 'str'}, + 'caching': {'key': 'caching', 'type': 'str'}, + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, + 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, + 'disk_encryption_set': {'key': 'diskEncryptionSet', 'type': 'DiskEncryptionSetParameters'}, + 'os_type': {'key': 'osType', 'type': 'str'}, + 'os_state': {'key': 'osState', 'type': 'str'}, + } + + def __init__( + self, + *, + os_type: Union[str, "OperatingSystemTypes"], + os_state: Union[str, "OperatingSystemStateTypes"], + snapshot: Optional["SubResource"] = None, + managed_disk: Optional["SubResource"] = None, + blob_uri: Optional[str] = None, + caching: Optional[Union[str, "CachingTypes"]] = None, + disk_size_gb: Optional[int] = None, + storage_account_type: Optional[Union[str, "StorageAccountTypes"]] = None, + disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, + **kwargs + ): + super(ImageOSDisk, self).__init__(snapshot=snapshot, managed_disk=managed_disk, blob_uri=blob_uri, caching=caching, disk_size_gb=disk_size_gb, storage_account_type=storage_account_type, disk_encryption_set=disk_encryption_set, **kwargs) + self.os_type = os_type + self.os_state = os_state + + +class ImageReference(SubResource): + """Specifies information about the image to use. You can specify information about platform images, marketplace images, or virtual machine images. This element is required when you want to use a platform image, marketplace image, or virtual machine image, but is not used in other creation operations. NOTE: Image reference publisher and offer can only be set when you create the scale set. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param id: Resource Id. + :type id: str + :param publisher: The image publisher. + :type publisher: str + :param offer: Specifies the offer of the platform image or marketplace image used to create the + virtual machine. + :type offer: str + :param sku: The image SKU. + :type sku: str + :param version: Specifies the version of the platform image or marketplace image used to create + the virtual machine. The allowed formats are Major.Minor.Build or 'latest'. Major, Minor, and + Build are decimal numbers. Specify 'latest' to use the latest version of an image available at + deploy time. Even if you use 'latest', the VM image will not automatically update after deploy + time even if a new version becomes available. + :type version: str + :ivar exact_version: Specifies in decimal numbers, the version of platform image or marketplace + image used to create the virtual machine. This readonly field differs from 'version', only if + the value specified in 'version' field is 'latest'. + :vartype exact_version: str + """ + + _validation = { + 'exact_version': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'offer': {'key': 'offer', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'exact_version': {'key': 'exactVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + publisher: Optional[str] = None, + offer: Optional[str] = None, + sku: Optional[str] = None, + version: Optional[str] = None, + **kwargs + ): + super(ImageReference, self).__init__(id=id, **kwargs) + self.publisher = publisher + self.offer = offer + self.sku = sku + self.version = version + self.exact_version = None + + +class ImageStorageProfile(msrest.serialization.Model): + """Describes a storage profile. + + :param os_disk: Specifies information about the operating system disk used by the virtual + machine. :code:`
    `:code:`
    ` For more information about disks, see `About disks and VHDs + for Azure virtual machines `_. + :type os_disk: ~azure.mgmt.compute.v2021_03_01.models.ImageOSDisk + :param data_disks: Specifies the parameters that are used to add a data disk to a virtual + machine. :code:`
    `:code:`
    ` For more information about disks, see `About disks and VHDs + for Azure virtual machines `_. + :type data_disks: list[~azure.mgmt.compute.v2021_03_01.models.ImageDataDisk] + :param zone_resilient: Specifies whether an image is zone resilient or not. Default is false. + Zone resilient images can be created only in regions that provide Zone Redundant Storage (ZRS). + :type zone_resilient: bool + """ + + _attribute_map = { + 'os_disk': {'key': 'osDisk', 'type': 'ImageOSDisk'}, + 'data_disks': {'key': 'dataDisks', 'type': '[ImageDataDisk]'}, + 'zone_resilient': {'key': 'zoneResilient', 'type': 'bool'}, + } + + def __init__( + self, + *, + os_disk: Optional["ImageOSDisk"] = None, + data_disks: Optional[List["ImageDataDisk"]] = None, + zone_resilient: Optional[bool] = None, + **kwargs + ): + super(ImageStorageProfile, self).__init__(**kwargs) + self.os_disk = os_disk + self.data_disks = data_disks + self.zone_resilient = zone_resilient + + +class ImageUpdate(UpdateResource): + """The source user image virtual hard disk. Only tags may be updated. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param source_virtual_machine: The source virtual machine from which Image is created. + :type source_virtual_machine: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param storage_profile: Specifies the storage settings for the virtual machine disks. + :type storage_profile: ~azure.mgmt.compute.v2021_03_01.models.ImageStorageProfile + :ivar provisioning_state: The provisioning state. + :vartype provisioning_state: str + :param hyper_v_generation: Specifies the HyperVGenerationType of the VirtualMachine created + from the image. From API Version 2019-03-01 if the image source is a blob, then we need the + user to specify the value, if the source is managed resource like disk or snapshot, we may + require the user to specify the property if we cannot deduce it from the source managed + resource. Possible values include: "V1", "V2". + :type hyper_v_generation: str or ~azure.mgmt.compute.v2021_03_01.models.HyperVGenerationTypes + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'source_virtual_machine': {'key': 'properties.sourceVirtualMachine', 'type': 'SubResource'}, + 'storage_profile': {'key': 'properties.storageProfile', 'type': 'ImageStorageProfile'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + source_virtual_machine: Optional["SubResource"] = None, + storage_profile: Optional["ImageStorageProfile"] = None, + hyper_v_generation: Optional[Union[str, "HyperVGenerationTypes"]] = None, + **kwargs + ): + super(ImageUpdate, self).__init__(tags=tags, **kwargs) + self.source_virtual_machine = source_virtual_machine + self.storage_profile = storage_profile + self.provisioning_state = None + self.hyper_v_generation = hyper_v_generation + + +class InnerError(msrest.serialization.Model): + """Inner error details. + + :param exceptiontype: The exception type. + :type exceptiontype: str + :param errordetail: The internal error message or exception dump. + :type errordetail: str + """ + + _attribute_map = { + 'exceptiontype': {'key': 'exceptiontype', 'type': 'str'}, + 'errordetail': {'key': 'errordetail', 'type': 'str'}, + } + + def __init__( + self, + *, + exceptiontype: Optional[str] = None, + errordetail: Optional[str] = None, + **kwargs + ): + super(InnerError, self).__init__(**kwargs) + self.exceptiontype = exceptiontype + self.errordetail = errordetail + + +class InstanceSku(msrest.serialization.Model): + """InstanceSku. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The sku name. + :vartype name: str + :ivar tier: The tier of the cloud service role instance. + :vartype tier: str + """ + + _validation = { + 'name': {'readonly': True}, + 'tier': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(InstanceSku, self).__init__(**kwargs) + self.name = None + self.tier = None + + +class InstanceViewStatus(msrest.serialization.Model): + """Instance view status. + + :param code: The status code. + :type code: str + :param level: The level code. Possible values include: "Info", "Warning", "Error". + :type level: str or ~azure.mgmt.compute.v2021_03_01.models.StatusLevelTypes + :param display_status: The short localizable label for the status. + :type display_status: str + :param message: The detailed status message, including for alerts and error messages. + :type message: str + :param time: The time of the status. + :type time: ~datetime.datetime + """ + + _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, + *, + code: Optional[str] = None, + level: Optional[Union[str, "StatusLevelTypes"]] = None, + display_status: Optional[str] = None, + message: Optional[str] = None, + time: Optional[datetime.datetime] = None, + **kwargs + ): + super(InstanceViewStatus, self).__init__(**kwargs) + self.code = code + self.level = level + self.display_status = display_status + self.message = message + self.time = time + + +class InstanceViewStatusesSummary(msrest.serialization.Model): + """Instance view statuses. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar statuses_summary: + :vartype statuses_summary: list[~azure.mgmt.compute.v2021_03_01.models.StatusCodeCount] + """ + + _validation = { + 'statuses_summary': {'readonly': True}, + } + + _attribute_map = { + 'statuses_summary': {'key': 'statusesSummary', 'type': '[StatusCodeCount]'}, + } + + def __init__( + self, + **kwargs + ): + super(InstanceViewStatusesSummary, self).__init__(**kwargs) + self.statuses_summary = None + + +class KeyVaultKeyReference(msrest.serialization.Model): + """Describes a reference to Key Vault Key. + + All required parameters must be populated in order to send to Azure. + + :param key_url: Required. The URL referencing a key encryption key in Key Vault. + :type key_url: str + :param source_vault: Required. The relative URL of the Key Vault containing the key. + :type source_vault: ~azure.mgmt.compute.v2021_03_01.models.SubResource + """ + + _validation = { + 'key_url': {'required': True}, + 'source_vault': {'required': True}, + } + + _attribute_map = { + 'key_url': {'key': 'keyUrl', 'type': 'str'}, + 'source_vault': {'key': 'sourceVault', 'type': 'SubResource'}, + } + + def __init__( + self, + *, + key_url: str, + source_vault: "SubResource", + **kwargs + ): + super(KeyVaultKeyReference, self).__init__(**kwargs) + self.key_url = key_url + self.source_vault = source_vault + + +class KeyVaultSecretReference(msrest.serialization.Model): + """Describes a reference to Key Vault Secret. + + All required parameters must be populated in order to send to Azure. + + :param secret_url: Required. The URL referencing a secret in a Key Vault. + :type secret_url: str + :param source_vault: Required. The relative URL of the Key Vault containing the secret. + :type source_vault: ~azure.mgmt.compute.v2021_03_01.models.SubResource + """ + + _validation = { + 'secret_url': {'required': True}, + 'source_vault': {'required': True}, + } + + _attribute_map = { + 'secret_url': {'key': 'secretUrl', 'type': 'str'}, + 'source_vault': {'key': 'sourceVault', 'type': 'SubResource'}, + } + + def __init__( + self, + *, + secret_url: str, + source_vault: "SubResource", + **kwargs + ): + super(KeyVaultSecretReference, self).__init__(**kwargs) + self.secret_url = secret_url + self.source_vault = source_vault + + +class LastPatchInstallationSummary(msrest.serialization.Model): + """Describes the properties of the last installed patch summary. + + 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 "Unknown", "Failed", "Succeeded", + or "CompletedWithWarnings.". Possible values include: "Unknown", "InProgress", "Failed", + "Succeeded", "CompletedWithWarnings". + :vartype status: str or ~azure.mgmt.compute.v2021_03_01.models.PatchOperationStatus + :ivar installation_activity_id: The activity ID of the operation that produced this result. It + is used to correlate across CRP and extension logs. + :vartype installation_activity_id: str + :ivar maintenance_window_exceeded: Describes whether the operation ran out of time before it + completed all its intended actions. + :vartype maintenance_window_exceeded: bool + :ivar not_selected_patch_count: The number of all available patches but not going to be + installed because it didn't match a classification or inclusion list entry. + :vartype not_selected_patch_count: int + :ivar excluded_patch_count: The number of all available patches but excluded explicitly by a + customer-specified exclusion list match. + :vartype excluded_patch_count: int + :ivar pending_patch_count: The number of all available patches expected to be installed over + the course of the patch installation operation. + :vartype pending_patch_count: int + :ivar installed_patch_count: The count of patches that successfully installed. + :vartype installed_patch_count: int + :ivar failed_patch_count: The count of patches that failed installation. + :vartype failed_patch_count: int + :ivar start_time: The UTC timestamp when the operation began. + :vartype start_time: ~datetime.datetime + :ivar last_modified_time: The UTC timestamp when the operation began. + :vartype last_modified_time: ~datetime.datetime + :ivar error: The errors that were encountered during execution of the operation. The details + array contains the list of them. + :vartype error: ~azure.mgmt.compute.v2021_03_01.models.ApiError + """ + + _validation = { + 'status': {'readonly': True}, + 'installation_activity_id': {'readonly': True}, + 'maintenance_window_exceeded': {'readonly': True}, + 'not_selected_patch_count': {'readonly': True}, + 'excluded_patch_count': {'readonly': True}, + 'pending_patch_count': {'readonly': True}, + 'installed_patch_count': {'readonly': True}, + 'failed_patch_count': {'readonly': True}, + 'start_time': {'readonly': True}, + 'last_modified_time': {'readonly': True}, + 'error': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'installation_activity_id': {'key': 'installationActivityId', 'type': 'str'}, + 'maintenance_window_exceeded': {'key': 'maintenanceWindowExceeded', 'type': 'bool'}, + 'not_selected_patch_count': {'key': 'notSelectedPatchCount', 'type': 'int'}, + 'excluded_patch_count': {'key': 'excludedPatchCount', 'type': 'int'}, + 'pending_patch_count': {'key': 'pendingPatchCount', 'type': 'int'}, + 'installed_patch_count': {'key': 'installedPatchCount', 'type': 'int'}, + 'failed_patch_count': {'key': 'failedPatchCount', 'type': 'int'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'last_modified_time': {'key': 'lastModifiedTime', 'type': 'iso-8601'}, + 'error': {'key': 'error', 'type': 'ApiError'}, + } + + def __init__( + self, + **kwargs + ): + super(LastPatchInstallationSummary, self).__init__(**kwargs) + self.status = None + self.installation_activity_id = None + self.maintenance_window_exceeded = None + self.not_selected_patch_count = None + self.excluded_patch_count = None + self.pending_patch_count = None + self.installed_patch_count = None + self.failed_patch_count = None + self.start_time = None + self.last_modified_time = None + self.error = None + + +class LinuxConfiguration(msrest.serialization.Model): + """Specifies the Linux operating system settings on the virtual machine. :code:`
    `:code:`
    `For a list of supported Linux distributions, see `Linux on Azure-Endorsed Distributions `_ :code:`
    `:code:`
    ` For running non-endorsed distributions, see `Information for Non-Endorsed Distributions `_. + + :param disable_password_authentication: Specifies whether password authentication should be + disabled. + :type disable_password_authentication: bool + :param ssh: Specifies the ssh key configuration for a Linux OS. + :type ssh: ~azure.mgmt.compute.v2021_03_01.models.SshConfiguration + :param provision_vm_agent: Indicates whether virtual machine agent should be provisioned on the + virtual machine. :code:`
    `:code:`
    ` When this property is not specified in the request + body, default behavior is to set it to true. This will ensure that VM Agent is installed on + the VM so that extensions can be added to the VM later. + :type provision_vm_agent: bool + :param patch_settings: [Preview Feature] Specifies settings related to VM Guest Patching on + Linux. + :type patch_settings: ~azure.mgmt.compute.v2021_03_01.models.LinuxPatchSettings + """ + + _attribute_map = { + 'disable_password_authentication': {'key': 'disablePasswordAuthentication', 'type': 'bool'}, + 'ssh': {'key': 'ssh', 'type': 'SshConfiguration'}, + 'provision_vm_agent': {'key': 'provisionVMAgent', 'type': 'bool'}, + 'patch_settings': {'key': 'patchSettings', 'type': 'LinuxPatchSettings'}, + } + + def __init__( + self, + *, + disable_password_authentication: Optional[bool] = None, + ssh: Optional["SshConfiguration"] = None, + provision_vm_agent: Optional[bool] = None, + patch_settings: Optional["LinuxPatchSettings"] = None, + **kwargs + ): + super(LinuxConfiguration, self).__init__(**kwargs) + self.disable_password_authentication = disable_password_authentication + self.ssh = ssh + self.provision_vm_agent = provision_vm_agent + self.patch_settings = patch_settings + + +class LinuxParameters(msrest.serialization.Model): + """Input for InstallPatches on a Linux VM, as directly received by the API. + + :param classifications_to_include: The update classifications to select when installing patches + for Linux. + :type classifications_to_include: list[str or + ~azure.mgmt.compute.v2021_03_01.models.VMGuestPatchClassificationLinux] + :param package_name_masks_to_include: packages to include in the patch operation. Format: + packageName_packageVersion. + :type package_name_masks_to_include: list[str] + :param package_name_masks_to_exclude: packages to exclude in the patch operation. Format: + packageName_packageVersion. + :type package_name_masks_to_exclude: list[str] + :param maintenance_run_id: This is used as a maintenance run identifier for Auto VM Guest + Patching in Linux. + :type maintenance_run_id: str + """ + + _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]'}, + 'maintenance_run_id': {'key': 'maintenanceRunId', 'type': 'str'}, + } + + def __init__( + self, + *, + classifications_to_include: Optional[List[Union[str, "VMGuestPatchClassificationLinux"]]] = None, + package_name_masks_to_include: Optional[List[str]] = None, + package_name_masks_to_exclude: Optional[List[str]] = None, + maintenance_run_id: Optional[str] = None, + **kwargs + ): + super(LinuxParameters, self).__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 + self.maintenance_run_id = maintenance_run_id + + +class LinuxPatchSettings(msrest.serialization.Model): + """Specifies settings related to VM Guest Patching on Linux. + + :param patch_mode: Specifies the mode of VM Guest Patching to IaaS virtual machine.:code:`
    `:code:`
    ` Possible values are::code:`
    `:code:`
    ` **ImageDefault** - The + virtual machine's default patching configuration is used. :code:`
    `:code:`
    ` + **AutomaticByPlatform** - The virtual machine will be automatically updated by the platform. + The property provisionVMAgent must be true. Possible values include: "ImageDefault", + "AutomaticByPlatform". + :type patch_mode: str or ~azure.mgmt.compute.v2021_03_01.models.LinuxVMGuestPatchMode + """ + + _attribute_map = { + 'patch_mode': {'key': 'patchMode', 'type': 'str'}, + } + + def __init__( + self, + *, + patch_mode: Optional[Union[str, "LinuxVMGuestPatchMode"]] = None, + **kwargs + ): + super(LinuxPatchSettings, self).__init__(**kwargs) + self.patch_mode = patch_mode + + +class ListUsagesResult(msrest.serialization.Model): + """The List Usages operation response. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. The list of compute resource usages. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.Usage] + :param next_link: The URI to fetch the next page of compute resource usage information. Call + ListNext() with this to fetch the next page of compute resource usage information. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Usage]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["Usage"], + next_link: Optional[str] = None, + **kwargs + ): + super(ListUsagesResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class LoadBalancerConfiguration(msrest.serialization.Model): + """Describes the load balancer configuration. + + All required parameters must be populated in order to send to Azure. + + :param id: Resource Id. + :type id: str + :param name: Required. The name of the Load balancer. + :type name: str + :param properties: Required. Properties of the load balancer configuration. + :type properties: ~azure.mgmt.compute.v2021_03_01.models.LoadBalancerConfigurationProperties + """ + + _validation = { + 'name': {'required': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'LoadBalancerConfigurationProperties'}, + } + + def __init__( + self, + *, + name: str, + properties: "LoadBalancerConfigurationProperties", + id: Optional[str] = None, + **kwargs + ): + super(LoadBalancerConfiguration, self).__init__(**kwargs) + self.id = id + self.name = name + self.properties = properties + + +class LoadBalancerConfigurationProperties(msrest.serialization.Model): + """LoadBalancerConfigurationProperties. + + All required parameters must be populated in order to send to Azure. + + :param frontend_ip_configurations: Required. Specifies the frontend IP to be used for the load + balancer. Only IPv4 frontend IP address is supported. Each load balancer configuration must + have exactly one frontend IP configuration. + :type frontend_ip_configurations: + list[~azure.mgmt.compute.v2021_03_01.models.LoadBalancerFrontendIPConfiguration] + """ + + _validation = { + 'frontend_ip_configurations': {'required': True}, + } + + _attribute_map = { + 'frontend_ip_configurations': {'key': 'frontendIPConfigurations', 'type': '[LoadBalancerFrontendIPConfiguration]'}, + } + + def __init__( + self, + *, + frontend_ip_configurations: List["LoadBalancerFrontendIPConfiguration"], + **kwargs + ): + super(LoadBalancerConfigurationProperties, self).__init__(**kwargs) + self.frontend_ip_configurations = frontend_ip_configurations + + +class LoadBalancerFrontendIPConfiguration(msrest.serialization.Model): + """LoadBalancerFrontendIPConfiguration. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the resource that is unique within the set of frontend IP + configurations used by the load balancer. This name can be used to access the resource. + :type name: str + :param properties: Required. Properties of load balancer frontend ip configuration. + :type properties: + ~azure.mgmt.compute.v2021_03_01.models.LoadBalancerFrontendIPConfigurationProperties + """ + + _validation = { + 'name': {'required': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'LoadBalancerFrontendIPConfigurationProperties'}, + } + + def __init__( + self, + *, + name: str, + properties: "LoadBalancerFrontendIPConfigurationProperties", + **kwargs + ): + super(LoadBalancerFrontendIPConfiguration, self).__init__(**kwargs) + self.name = name + self.properties = properties + + +class LoadBalancerFrontendIPConfigurationProperties(msrest.serialization.Model): + """Describes a cloud service IP Configuration. + + :param public_ip_address: The reference to the public ip address resource. + :type public_ip_address: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param subnet: The reference to the virtual network subnet resource. + :type subnet: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param private_ip_address: The virtual network private IP address of the IP configuration. + :type private_ip_address: str + """ + + _attribute_map = { + 'public_ip_address': {'key': 'publicIPAddress', 'type': 'SubResource'}, + 'subnet': {'key': 'subnet', 'type': 'SubResource'}, + 'private_ip_address': {'key': 'privateIPAddress', 'type': 'str'}, + } + + def __init__( + self, + *, + public_ip_address: Optional["SubResource"] = None, + subnet: Optional["SubResource"] = None, + private_ip_address: Optional[str] = None, + **kwargs + ): + super(LoadBalancerFrontendIPConfigurationProperties, self).__init__(**kwargs) + self.public_ip_address = public_ip_address + self.subnet = subnet + self.private_ip_address = private_ip_address + + +class LogAnalyticsInputBase(msrest.serialization.Model): + """Api input base class for LogAnalytics Api. + + All required parameters must be populated in order to send to Azure. + + :param blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :type blob_container_sas_uri: str + :param from_time: Required. From time of the query. + :type from_time: ~datetime.datetime + :param to_time: Required. To time of the query. + :type to_time: ~datetime.datetime + :param group_by_throttle_policy: Group query result by Throttle Policy applied. + :type group_by_throttle_policy: bool + :param group_by_operation_name: Group query result by Operation Name. + :type group_by_operation_name: bool + :param group_by_resource_name: Group query result by Resource Name. + :type group_by_resource_name: bool + :param group_by_client_application_id: Group query result by Client Application ID. + :type group_by_client_application_id: bool + :param group_by_user_agent: Group query result by User Agent. + :type group_by_user_agent: bool + """ + + _validation = { + 'blob_container_sas_uri': {'required': True}, + 'from_time': {'required': True}, + 'to_time': {'required': True}, + } + + _attribute_map = { + 'blob_container_sas_uri': {'key': 'blobContainerSasUri', 'type': 'str'}, + 'from_time': {'key': 'fromTime', 'type': 'iso-8601'}, + 'to_time': {'key': 'toTime', 'type': 'iso-8601'}, + 'group_by_throttle_policy': {'key': 'groupByThrottlePolicy', 'type': 'bool'}, + 'group_by_operation_name': {'key': 'groupByOperationName', 'type': 'bool'}, + 'group_by_resource_name': {'key': 'groupByResourceName', 'type': 'bool'}, + 'group_by_client_application_id': {'key': 'groupByClientApplicationId', 'type': 'bool'}, + 'group_by_user_agent': {'key': 'groupByUserAgent', 'type': 'bool'}, + } + + def __init__( + self, + *, + blob_container_sas_uri: str, + from_time: datetime.datetime, + to_time: datetime.datetime, + group_by_throttle_policy: Optional[bool] = None, + group_by_operation_name: Optional[bool] = None, + group_by_resource_name: Optional[bool] = None, + group_by_client_application_id: Optional[bool] = None, + group_by_user_agent: Optional[bool] = None, + **kwargs + ): + super(LogAnalyticsInputBase, self).__init__(**kwargs) + self.blob_container_sas_uri = blob_container_sas_uri + self.from_time = from_time + self.to_time = to_time + self.group_by_throttle_policy = group_by_throttle_policy + self.group_by_operation_name = group_by_operation_name + self.group_by_resource_name = group_by_resource_name + self.group_by_client_application_id = group_by_client_application_id + self.group_by_user_agent = group_by_user_agent + + +class LogAnalyticsOperationResult(msrest.serialization.Model): + """LogAnalytics operation status response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar properties: LogAnalyticsOutput. + :vartype properties: ~azure.mgmt.compute.v2021_03_01.models.LogAnalyticsOutput + """ + + _validation = { + 'properties': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'LogAnalyticsOutput'}, + } + + def __init__( + self, + **kwargs + ): + super(LogAnalyticsOperationResult, self).__init__(**kwargs) + self.properties = None + + +class LogAnalyticsOutput(msrest.serialization.Model): + """LogAnalytics output properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar output: Output file Uri path to blob container. + :vartype output: str + """ + + _validation = { + 'output': {'readonly': True}, + } + + _attribute_map = { + 'output': {'key': 'output', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(LogAnalyticsOutput, self).__init__(**kwargs) + self.output = None + + +class MaintenanceRedeployStatus(msrest.serialization.Model): + """Maintenance Operation Status. + + :param is_customer_initiated_maintenance_allowed: True, if customer is allowed to perform + Maintenance. + :type is_customer_initiated_maintenance_allowed: bool + :param pre_maintenance_window_start_time: Start Time for the Pre Maintenance Window. + :type pre_maintenance_window_start_time: ~datetime.datetime + :param pre_maintenance_window_end_time: End Time for the Pre Maintenance Window. + :type pre_maintenance_window_end_time: ~datetime.datetime + :param maintenance_window_start_time: Start Time for the Maintenance Window. + :type maintenance_window_start_time: ~datetime.datetime + :param maintenance_window_end_time: End Time for the Maintenance Window. + :type maintenance_window_end_time: ~datetime.datetime + :param last_operation_result_code: The Last Maintenance Operation Result Code. Possible values + include: "None", "RetryLater", "MaintenanceAborted", "MaintenanceCompleted". + :type last_operation_result_code: str or + ~azure.mgmt.compute.v2021_03_01.models.MaintenanceOperationResultCodeTypes + :param last_operation_message: Message returned for the last Maintenance Operation. + :type last_operation_message: str + """ + + _attribute_map = { + 'is_customer_initiated_maintenance_allowed': {'key': 'isCustomerInitiatedMaintenanceAllowed', 'type': 'bool'}, + 'pre_maintenance_window_start_time': {'key': 'preMaintenanceWindowStartTime', 'type': 'iso-8601'}, + 'pre_maintenance_window_end_time': {'key': 'preMaintenanceWindowEndTime', 'type': 'iso-8601'}, + 'maintenance_window_start_time': {'key': 'maintenanceWindowStartTime', 'type': 'iso-8601'}, + 'maintenance_window_end_time': {'key': 'maintenanceWindowEndTime', 'type': 'iso-8601'}, + 'last_operation_result_code': {'key': 'lastOperationResultCode', 'type': 'str'}, + 'last_operation_message': {'key': 'lastOperationMessage', 'type': 'str'}, + } + + def __init__( + self, + *, + is_customer_initiated_maintenance_allowed: Optional[bool] = None, + pre_maintenance_window_start_time: Optional[datetime.datetime] = None, + pre_maintenance_window_end_time: Optional[datetime.datetime] = None, + maintenance_window_start_time: Optional[datetime.datetime] = None, + maintenance_window_end_time: Optional[datetime.datetime] = None, + last_operation_result_code: Optional[Union[str, "MaintenanceOperationResultCodeTypes"]] = None, + last_operation_message: Optional[str] = None, + **kwargs + ): + super(MaintenanceRedeployStatus, self).__init__(**kwargs) + self.is_customer_initiated_maintenance_allowed = is_customer_initiated_maintenance_allowed + self.pre_maintenance_window_start_time = pre_maintenance_window_start_time + self.pre_maintenance_window_end_time = pre_maintenance_window_end_time + self.maintenance_window_start_time = maintenance_window_start_time + self.maintenance_window_end_time = maintenance_window_end_time + self.last_operation_result_code = last_operation_result_code + self.last_operation_message = last_operation_message + + +class ManagedDiskParameters(SubResource): + """The parameters of a managed disk. + + :param id: Resource Id. + :type id: str + :param storage_account_type: Specifies the storage account type for the managed disk. NOTE: + UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. Possible values + include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", + "StandardSSD_ZRS". + :type storage_account_type: str or ~azure.mgmt.compute.v2021_03_01.models.StorageAccountTypes + :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + the managed disk. + :type disk_encryption_set: ~azure.mgmt.compute.v2021_03_01.models.DiskEncryptionSetParameters + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, + 'disk_encryption_set': {'key': 'diskEncryptionSet', 'type': 'DiskEncryptionSetParameters'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + storage_account_type: Optional[Union[str, "StorageAccountTypes"]] = None, + disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, + **kwargs + ): + super(ManagedDiskParameters, self).__init__(id=id, **kwargs) + self.storage_account_type = storage_account_type + self.disk_encryption_set = disk_encryption_set + + +class NetworkInterfaceReference(SubResource): + """Describes a network interface reference. + + :param id: Resource Id. + :type id: str + :param primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :type primary: bool + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'primary': {'key': 'properties.primary', 'type': 'bool'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + primary: Optional[bool] = None, + **kwargs + ): + super(NetworkInterfaceReference, self).__init__(id=id, **kwargs) + self.primary = primary + + +class NetworkProfile(msrest.serialization.Model): + """Specifies the network interfaces of the virtual machine. + + :param network_interfaces: Specifies the list of resource Ids for the network interfaces + associated with the virtual machine. + :type network_interfaces: + list[~azure.mgmt.compute.v2021_03_01.models.NetworkInterfaceReference] + """ + + _attribute_map = { + 'network_interfaces': {'key': 'networkInterfaces', 'type': '[NetworkInterfaceReference]'}, + } + + def __init__( + self, + *, + network_interfaces: Optional[List["NetworkInterfaceReference"]] = None, + **kwargs + ): + super(NetworkProfile, self).__init__(**kwargs) + self.network_interfaces = network_interfaces + + +class OrchestrationServiceStateInput(msrest.serialization.Model): + """The input for OrchestrationServiceState. + + All required parameters must be populated in order to send to Azure. + + :param service_name: Required. The name of the service. Possible values include: + "AutomaticRepairs", "DummyOrchestrationServiceName". + :type service_name: str or ~azure.mgmt.compute.v2021_03_01.models.OrchestrationServiceNames + :param action: Required. The action to be performed. Possible values include: "Resume", + "Suspend". + :type action: str or ~azure.mgmt.compute.v2021_03_01.models.OrchestrationServiceStateAction + """ + + _validation = { + 'service_name': {'required': True}, + 'action': {'required': True}, + } + + _attribute_map = { + 'service_name': {'key': 'serviceName', 'type': 'str'}, + 'action': {'key': 'action', 'type': 'str'}, + } + + def __init__( + self, + *, + service_name: Union[str, "OrchestrationServiceNames"], + action: Union[str, "OrchestrationServiceStateAction"], + **kwargs + ): + super(OrchestrationServiceStateInput, self).__init__(**kwargs) + self.service_name = service_name + self.action = action + + +class OrchestrationServiceSummary(msrest.serialization.Model): + """Summary for an orchestration service of a virtual machine scale set. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar service_name: The name of the service. Possible values include: "AutomaticRepairs", + "DummyOrchestrationServiceName". + :vartype service_name: str or ~azure.mgmt.compute.v2021_03_01.models.OrchestrationServiceNames + :ivar service_state: The current state of the service. Possible values include: "NotRunning", + "Running", "Suspended". + :vartype service_state: str or ~azure.mgmt.compute.v2021_03_01.models.OrchestrationServiceState + """ + + _validation = { + 'service_name': {'readonly': True}, + 'service_state': {'readonly': True}, + } + + _attribute_map = { + 'service_name': {'key': 'serviceName', 'type': 'str'}, + 'service_state': {'key': 'serviceState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OrchestrationServiceSummary, self).__init__(**kwargs) + self.service_name = None + self.service_state = None + + +class OSDisk(msrest.serialization.Model): + """Specifies information about the operating system disk used by the virtual machine. :code:`
    `:code:`
    ` For more information about disks, see `About disks and VHDs for Azure virtual machines `_. + + All required parameters must be populated in order to send to Azure. + + :param os_type: This property allows you to specify the type of the OS that is included in the + disk if creating a VM from user-image or a specialized VHD. :code:`
    `:code:`
    ` Possible + values are: :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible + values include: "Windows", "Linux". + :type os_type: str or ~azure.mgmt.compute.v2021_03_01.models.OperatingSystemTypes + :param encryption_settings: Specifies the encryption settings for the OS Disk. + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :type encryption_settings: ~azure.mgmt.compute.v2021_03_01.models.DiskEncryptionSettings + :param name: The disk name. + :type name: str + :param vhd: The virtual hard disk. + :type vhd: ~azure.mgmt.compute.v2021_03_01.models.VirtualHardDisk + :param image: The source user image virtual hard disk. The virtual hard disk will be copied + before being attached to the virtual machine. If SourceImage is provided, the destination + virtual hard drive must not exist. + :type image: ~azure.mgmt.compute.v2021_03_01.models.VirtualHardDisk + :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + are: :code:`
    `:code:`
    ` **None** :code:`
    `:code:`
    ` **ReadOnly** + :code:`
    `:code:`
    ` **ReadWrite** :code:`
    `:code:`
    ` Default: **None** for Standard + storage. **ReadOnly** for Premium storage. Possible values include: "None", "ReadOnly", + "ReadWrite". + :type caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes + :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :type write_accelerator_enabled: bool + :param diff_disk_settings: Specifies the ephemeral Disk Settings for the operating system disk + used by the virtual machine. + :type diff_disk_settings: ~azure.mgmt.compute.v2021_03_01.models.DiffDiskSettings + :param create_option: Required. Specifies how the virtual machine should be + created.:code:`
    `:code:`
    ` Possible values are::code:`
    `:code:`
    ` **Attach** \u2013 + This value is used when you are using a specialized disk to create the virtual + machine.:code:`
    `:code:`
    ` **FromImage** \u2013 This value is used when you are using an + image to create the virtual machine. If you are using a platform image, you also use the + imageReference element described above. If you are using a marketplace image, you also use the + plan element previously described. Possible values include: "FromImage", "Empty", "Attach". + :type create_option: str or ~azure.mgmt.compute.v2021_03_01.models.DiskCreateOptionTypes + :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + used to overwrite the size of the disk in a virtual machine image. :code:`
    `:code:`
    ` + This value cannot be larger than 1023 GB. + :type disk_size_gb: int + :param managed_disk: The managed disk parameters. + :type managed_disk: ~azure.mgmt.compute.v2021_03_01.models.ManagedDiskParameters + """ + + _validation = { + 'create_option': {'required': True}, + } + + _attribute_map = { + 'os_type': {'key': 'osType', 'type': 'str'}, + 'encryption_settings': {'key': 'encryptionSettings', 'type': 'DiskEncryptionSettings'}, + 'name': {'key': 'name', 'type': 'str'}, + 'vhd': {'key': 'vhd', 'type': 'VirtualHardDisk'}, + 'image': {'key': 'image', 'type': 'VirtualHardDisk'}, + 'caching': {'key': 'caching', 'type': 'str'}, + 'write_accelerator_enabled': {'key': 'writeAcceleratorEnabled', 'type': 'bool'}, + 'diff_disk_settings': {'key': 'diffDiskSettings', 'type': 'DiffDiskSettings'}, + 'create_option': {'key': 'createOption', 'type': 'str'}, + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, + 'managed_disk': {'key': 'managedDisk', 'type': 'ManagedDiskParameters'}, + } + + def __init__( + self, + *, + create_option: Union[str, "DiskCreateOptionTypes"], + os_type: Optional[Union[str, "OperatingSystemTypes"]] = None, + encryption_settings: Optional["DiskEncryptionSettings"] = None, + name: Optional[str] = None, + vhd: Optional["VirtualHardDisk"] = None, + image: Optional["VirtualHardDisk"] = None, + caching: Optional[Union[str, "CachingTypes"]] = None, + write_accelerator_enabled: Optional[bool] = None, + diff_disk_settings: Optional["DiffDiskSettings"] = None, + disk_size_gb: Optional[int] = None, + managed_disk: Optional["ManagedDiskParameters"] = None, + **kwargs + ): + super(OSDisk, self).__init__(**kwargs) + self.os_type = os_type + self.encryption_settings = encryption_settings + self.name = name + self.vhd = vhd + self.image = image + self.caching = caching + self.write_accelerator_enabled = write_accelerator_enabled + self.diff_disk_settings = diff_disk_settings + self.create_option = create_option + self.disk_size_gb = disk_size_gb + self.managed_disk = managed_disk + + +class OSDiskImage(msrest.serialization.Model): + """Contains the os disk image information. + + All required parameters must be populated in order to send to Azure. + + :param operating_system: Required. The operating system of the osDiskImage. Possible values + include: "Windows", "Linux". + :type operating_system: str or ~azure.mgmt.compute.v2021_03_01.models.OperatingSystemTypes + """ + + _validation = { + 'operating_system': {'required': True}, + } + + _attribute_map = { + 'operating_system': {'key': 'operatingSystem', 'type': 'str'}, + } + + def __init__( + self, + *, + operating_system: Union[str, "OperatingSystemTypes"], + **kwargs + ): + super(OSDiskImage, self).__init__(**kwargs) + self.operating_system = operating_system + + +class OSFamily(msrest.serialization.Model): + """Describes a cloud service OS family. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :param properties: OS family properties. + :type properties: ~azure.mgmt.compute.v2021_03_01.models.OSFamilyProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'OSFamilyProperties'}, + } + + def __init__( + self, + *, + properties: Optional["OSFamilyProperties"] = None, + **kwargs + ): + super(OSFamily, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = None + self.properties = properties + + +class OSFamilyListResult(msrest.serialization.Model): + """OSFamilyListResult. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.OSFamily] + :param next_link: + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OSFamily]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["OSFamily"], + next_link: Optional[str] = None, + **kwargs + ): + super(OSFamilyListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class OSFamilyProperties(msrest.serialization.Model): + """OS family properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The OS family name. + :vartype name: str + :ivar label: The OS family label. + :vartype label: str + :ivar versions: List of OS versions belonging to this family. + :vartype versions: list[~azure.mgmt.compute.v2021_03_01.models.OSVersionPropertiesBase] + """ + + _validation = { + 'name': {'readonly': True}, + 'label': {'readonly': True}, + 'versions': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'label': {'key': 'label', 'type': 'str'}, + 'versions': {'key': 'versions', 'type': '[OSVersionPropertiesBase]'}, + } + + def __init__( + self, + **kwargs + ): + super(OSFamilyProperties, self).__init__(**kwargs) + self.name = None + self.label = None + self.versions = None + + +class OSProfile(msrest.serialization.Model): + """Specifies the operating system settings for the virtual machine. Some of the settings cannot be changed once VM is provisioned. + + :param computer_name: Specifies the host OS name of the virtual machine. + :code:`
    `:code:`
    ` This name cannot be updated after the VM is created. + :code:`
    `:code:`
    ` **Max-length (Windows):** 15 characters :code:`
    `:code:`
    ` + **Max-length (Linux):** 64 characters. :code:`
    `:code:`
    ` For naming conventions and + restrictions see `Azure infrastructure services implementation guidelines + `_. + :type computer_name: str + :param admin_username: Specifies the name of the administrator account. + :code:`
    `:code:`
    ` This property cannot be updated after the VM is created. + :code:`
    `:code:`
    ` **Windows-only restriction:** Cannot end in "." + :code:`
    `:code:`
    ` **Disallowed values:** "administrator", "admin", "user", "user1", + "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", + "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", + "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". + :code:`
    `:code:`
    ` **Minimum-length (Linux):** 1 character :code:`
    `:code:`
    ` + **Max-length (Linux):** 64 characters :code:`
    `:code:`
    ` **Max-length (Windows):** 20 + characters :code:`
    `:code:`
    `:code:`
  • ` For root access to the Linux VM, see `Using + root privileges on Linux virtual machines in Azure `_\ :code:`
    `:code:`
  • ` For a list of built-in system users on + Linux that should not be used in this field, see `Selecting User Names for Linux on Azure + `_. + :type admin_username: str + :param admin_password: Specifies the password of the administrator account. + :code:`
    `:code:`
    ` **Minimum-length (Windows):** 8 characters :code:`
    `:code:`
    ` + **Minimum-length (Linux):** 6 characters :code:`
    `:code:`
    ` **Max-length (Windows):** 123 + characters :code:`
    `:code:`
    ` **Max-length (Linux):** 72 characters + :code:`
    `:code:`
    ` **Complexity requirements:** 3 out of 4 conditions below need to be + fulfilled :code:`
    ` Has lower characters :code:`
    `Has upper characters :code:`
    ` Has a + digit :code:`
    ` Has a special character (Regex match [\W_]) :code:`
    `:code:`
    ` + **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", + "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" :code:`
    `:code:`
    ` For + resetting the password, see `How to reset the Remote Desktop service or its login password in a + Windows VM `_ :code:`
    `:code:`
    ` For + resetting root password, see `Manage users, SSH, and check or repair disks on Azure Linux VMs + using the VMAccess Extension `_. + :type admin_password: str + :param custom_data: Specifies a base-64 encoded string of custom data. The base-64 encoded + string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum + length of the binary array is 65535 bytes. :code:`
    `:code:`
    ` **Note: Do not pass any + secrets or passwords in customData property** :code:`
    `:code:`
    ` This property cannot be + updated after the VM is created. :code:`
    `:code:`
    ` customData is passed to the VM to be + saved as a file, for more information see `Custom Data on Azure VMs + `_ + :code:`
    `:code:`
    ` For using cloud-init for your Linux VM, see `Using cloud-init to + customize a Linux VM during creation `_. + :type custom_data: str + :param windows_configuration: Specifies Windows operating system settings on the virtual + machine. + :type windows_configuration: ~azure.mgmt.compute.v2021_03_01.models.WindowsConfiguration + :param linux_configuration: Specifies the Linux operating system settings on the virtual + machine. :code:`
    `:code:`
    `For a list of supported Linux distributions, see `Linux on + Azure-Endorsed Distributions `_ + :code:`
    `:code:`
    ` For running non-endorsed distributions, see `Information for Non- + Endorsed Distributions `_. + :type linux_configuration: ~azure.mgmt.compute.v2021_03_01.models.LinuxConfiguration + :param secrets: Specifies set of certificates that should be installed onto the virtual + machine. + :type secrets: list[~azure.mgmt.compute.v2021_03_01.models.VaultSecretGroup] + :param allow_extension_operations: Specifies whether extension operations should be allowed on + the virtual machine. :code:`
    `:code:`
    `This may only be set to False when no extensions + are present on the virtual machine. + :type allow_extension_operations: bool + :param require_guest_provision_signal: Specifies whether the guest provision signal is required + to infer provision success of the virtual machine. **Note: This property is for private + testing only, and all customers must not set the property to false.**. + :type require_guest_provision_signal: bool + """ + + _attribute_map = { + 'computer_name': {'key': 'computerName', 'type': 'str'}, + 'admin_username': {'key': 'adminUsername', 'type': 'str'}, + 'admin_password': {'key': 'adminPassword', 'type': 'str'}, + 'custom_data': {'key': 'customData', 'type': 'str'}, + 'windows_configuration': {'key': 'windowsConfiguration', 'type': 'WindowsConfiguration'}, + 'linux_configuration': {'key': 'linuxConfiguration', 'type': 'LinuxConfiguration'}, + 'secrets': {'key': 'secrets', 'type': '[VaultSecretGroup]'}, + 'allow_extension_operations': {'key': 'allowExtensionOperations', 'type': 'bool'}, + 'require_guest_provision_signal': {'key': 'requireGuestProvisionSignal', 'type': 'bool'}, + } + + def __init__( + self, + *, + computer_name: Optional[str] = None, + admin_username: Optional[str] = None, + admin_password: Optional[str] = None, + custom_data: Optional[str] = None, + windows_configuration: Optional["WindowsConfiguration"] = None, + linux_configuration: Optional["LinuxConfiguration"] = None, + secrets: Optional[List["VaultSecretGroup"]] = None, + allow_extension_operations: Optional[bool] = None, + require_guest_provision_signal: Optional[bool] = None, + **kwargs + ): + super(OSProfile, self).__init__(**kwargs) + self.computer_name = computer_name + self.admin_username = admin_username + self.admin_password = admin_password + self.custom_data = custom_data + self.windows_configuration = windows_configuration + self.linux_configuration = linux_configuration + self.secrets = secrets + self.allow_extension_operations = allow_extension_operations + self.require_guest_provision_signal = require_guest_provision_signal + + +class OSVersion(msrest.serialization.Model): + """Describes a cloud service OS version. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :param properties: OS version properties. + :type properties: ~azure.mgmt.compute.v2021_03_01.models.OSVersionProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'OSVersionProperties'}, + } + + def __init__( + self, + *, + properties: Optional["OSVersionProperties"] = None, + **kwargs + ): + super(OSVersion, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = None + self.properties = properties + + +class OSVersionListResult(msrest.serialization.Model): + """OSVersionListResult. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.OSVersion] + :param next_link: + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OSVersion]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["OSVersion"], + next_link: Optional[str] = None, + **kwargs + ): + super(OSVersionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class OSVersionProperties(msrest.serialization.Model): + """OS version properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar family: The family of this OS version. + :vartype family: str + :ivar family_label: The family label of this OS version. + :vartype family_label: str + :ivar version: The OS version. + :vartype version: str + :ivar label: The OS version label. + :vartype label: str + :ivar is_default: Specifies whether this is the default OS version for its family. + :vartype is_default: bool + :ivar is_active: Specifies whether this OS version is active. + :vartype is_active: bool + """ + + _validation = { + 'family': {'readonly': True}, + 'family_label': {'readonly': True}, + 'version': {'readonly': True}, + 'label': {'readonly': True}, + 'is_default': {'readonly': True}, + 'is_active': {'readonly': True}, + } + + _attribute_map = { + 'family': {'key': 'family', 'type': 'str'}, + 'family_label': {'key': 'familyLabel', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'label': {'key': 'label', 'type': 'str'}, + 'is_default': {'key': 'isDefault', 'type': 'bool'}, + 'is_active': {'key': 'isActive', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(OSVersionProperties, self).__init__(**kwargs) + self.family = None + self.family_label = None + self.version = None + self.label = None + self.is_default = None + self.is_active = None + + +class OSVersionPropertiesBase(msrest.serialization.Model): + """Configuration view of an OS version. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar version: The OS version. + :vartype version: str + :ivar label: The OS version label. + :vartype label: str + :ivar is_default: Specifies whether this is the default OS version for its family. + :vartype is_default: bool + :ivar is_active: Specifies whether this OS version is active. + :vartype is_active: bool + """ + + _validation = { + 'version': {'readonly': True}, + 'label': {'readonly': True}, + 'is_default': {'readonly': True}, + 'is_active': {'readonly': True}, + } + + _attribute_map = { + 'version': {'key': 'version', 'type': 'str'}, + 'label': {'key': 'label', 'type': 'str'}, + 'is_default': {'key': 'isDefault', 'type': 'bool'}, + 'is_active': {'key': 'isActive', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(OSVersionPropertiesBase, self).__init__(**kwargs) + self.version = None + self.label = None + self.is_default = None + self.is_active = None + + +class PatchInstallationDetail(msrest.serialization.Model): + """Information about a specific patch that was encountered during an installation action. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar patch_id: A unique identifier for the patch. + :vartype patch_id: str + :ivar name: The friendly name of the patch. + :vartype name: str + :ivar version: The version string of the package. It may conform to Semantic Versioning. Only + applies to Linux. + :vartype version: str + :ivar kb_id: The KBID of the patch. Only applies to Windows patches. + :vartype kb_id: str + :ivar classifications: The classification(s) of the patch as provided by the patch publisher. + :vartype classifications: list[str] + :ivar installation_state: The state of the patch after the installation operation completed. + Possible values include: "Unknown", "Installed", "Failed", "Excluded", "NotSelected", + "Pending". + :vartype installation_state: str or + ~azure.mgmt.compute.v2021_03_01.models.PatchInstallationState + """ + + _validation = { + 'patch_id': {'readonly': True}, + 'name': {'readonly': True}, + 'version': {'readonly': True}, + 'kb_id': {'readonly': True}, + 'classifications': {'readonly': True}, + 'installation_state': {'readonly': True}, + } + + _attribute_map = { + 'patch_id': {'key': 'patchId', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'kb_id': {'key': 'kbId', 'type': 'str'}, + 'classifications': {'key': 'classifications', 'type': '[str]'}, + 'installation_state': {'key': 'installationState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PatchInstallationDetail, self).__init__(**kwargs) + self.patch_id = None + self.name = None + self.version = None + self.kb_id = None + self.classifications = None + self.installation_state = None + + +class PatchSettings(msrest.serialization.Model): + """Specifies settings related to VM Guest Patching on Windows. + + :param patch_mode: Specifies the mode of VM Guest Patching to IaaS virtual machine.:code:`
    `:code:`
    ` Possible values are::code:`
    `:code:`
    ` **Manual** - You control + the application of patches to a virtual machine. You do this by applying patches manually + inside the VM. In this mode, automatic updates are disabled; the property + WindowsConfiguration.enableAutomaticUpdates must be false:code:`
    `:code:`
    ` + **AutomaticByOS** - The virtual machine will automatically be updated by the OS. The property + WindowsConfiguration.enableAutomaticUpdates must be true. :code:`
    `:code:`
    ` + **AutomaticByPlatform** - the virtual machine will automatically updated by the platform. The + properties provisionVMAgent and WindowsConfiguration.enableAutomaticUpdates must be true. + Possible values include: "Manual", "AutomaticByOS", "AutomaticByPlatform". + :type patch_mode: str or ~azure.mgmt.compute.v2021_03_01.models.WindowsVMGuestPatchMode + :param enable_hotpatching: Enables customers to patch their Azure VMs without requiring a + reboot. For enableHotpatching, the 'provisionVMAgent' must be set to true and 'patchMode' must + be set to 'AutomaticByPlatform'. + :type enable_hotpatching: bool + """ + + _attribute_map = { + 'patch_mode': {'key': 'patchMode', 'type': 'str'}, + 'enable_hotpatching': {'key': 'enableHotpatching', 'type': 'bool'}, + } + + def __init__( + self, + *, + patch_mode: Optional[Union[str, "WindowsVMGuestPatchMode"]] = None, + enable_hotpatching: Optional[bool] = None, + **kwargs + ): + super(PatchSettings, self).__init__(**kwargs) + self.patch_mode = patch_mode + self.enable_hotpatching = enable_hotpatching + + +class Plan(msrest.serialization.Model): + """Specifies information about the marketplace image used to create the virtual machine. This element is only used for marketplace images. Before you can use a marketplace image from an API, you must enable the image for programmatic use. In the Azure portal, find the marketplace image that you want to use and then click **Want to deploy programmatically, Get Started ->**. Enter any required information and then click **Save**. + + :param name: The plan ID. + :type name: str + :param publisher: The publisher ID. + :type publisher: str + :param product: Specifies the product of the image from the marketplace. This is the same value + as Offer under the imageReference element. + :type product: str + :param promotion_code: The promotion code. + :type promotion_code: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'product': {'key': 'product', 'type': 'str'}, + 'promotion_code': {'key': 'promotionCode', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + publisher: Optional[str] = None, + product: Optional[str] = None, + promotion_code: Optional[str] = None, + **kwargs + ): + super(Plan, self).__init__(**kwargs) + self.name = name + self.publisher = publisher + self.product = product + self.promotion_code = promotion_code + + +class ProximityPlacementGroup(Resource): + """Specifies information about the proximity placement group. + + 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 id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param proximity_placement_group_type: Specifies the type of the proximity placement group. + :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` **Standard** : Co-locate + resources within an Azure region or Availability Zone. :code:`
    `:code:`
    ` **Ultra** : For + future use. Possible values include: "Standard", "Ultra". + :type proximity_placement_group_type: str or + ~azure.mgmt.compute.v2021_03_01.models.ProximityPlacementGroupType + :ivar virtual_machines: A list of references to all virtual machines in the proximity placement + group. + :vartype virtual_machines: + list[~azure.mgmt.compute.v2021_03_01.models.SubResourceWithColocationStatus] + :ivar virtual_machine_scale_sets: A list of references to all virtual machine scale sets in the + proximity placement group. + :vartype virtual_machine_scale_sets: + list[~azure.mgmt.compute.v2021_03_01.models.SubResourceWithColocationStatus] + :ivar availability_sets: A list of references to all availability sets in the proximity + placement group. + :vartype availability_sets: + list[~azure.mgmt.compute.v2021_03_01.models.SubResourceWithColocationStatus] + :param colocation_status: Describes colocation status of the Proximity Placement Group. + :type colocation_status: ~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'virtual_machines': {'readonly': True}, + 'virtual_machine_scale_sets': {'readonly': True}, + 'availability_sets': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'proximity_placement_group_type': {'key': 'properties.proximityPlacementGroupType', 'type': 'str'}, + 'virtual_machines': {'key': 'properties.virtualMachines', 'type': '[SubResourceWithColocationStatus]'}, + 'virtual_machine_scale_sets': {'key': 'properties.virtualMachineScaleSets', 'type': '[SubResourceWithColocationStatus]'}, + 'availability_sets': {'key': 'properties.availabilitySets', 'type': '[SubResourceWithColocationStatus]'}, + 'colocation_status': {'key': 'properties.colocationStatus', 'type': 'InstanceViewStatus'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + proximity_placement_group_type: Optional[Union[str, "ProximityPlacementGroupType"]] = None, + colocation_status: Optional["InstanceViewStatus"] = None, + **kwargs + ): + super(ProximityPlacementGroup, self).__init__(location=location, tags=tags, **kwargs) + self.proximity_placement_group_type = proximity_placement_group_type + self.virtual_machines = None + self.virtual_machine_scale_sets = None + self.availability_sets = None + self.colocation_status = colocation_status + + +class ProximityPlacementGroupListResult(msrest.serialization.Model): + """The List Proximity Placement Group operation response. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. The list of proximity placement groups. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.ProximityPlacementGroup] + :param next_link: The URI to fetch the next page of proximity placement groups. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ProximityPlacementGroup]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["ProximityPlacementGroup"], + next_link: Optional[str] = None, + **kwargs + ): + super(ProximityPlacementGroupListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ProximityPlacementGroupUpdate(UpdateResource): + """Specifies information about the proximity placement group. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(ProximityPlacementGroupUpdate, self).__init__(tags=tags, **kwargs) + + +class PurchasePlan(msrest.serialization.Model): + """Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. + + All required parameters must be populated in order to send to Azure. + + :param publisher: Required. The publisher ID. + :type publisher: str + :param name: Required. The plan ID. + :type name: str + :param product: Required. Specifies the product of the image from the marketplace. This is the + same value as Offer under the imageReference element. + :type product: str + """ + + _validation = { + 'publisher': {'required': True}, + 'name': {'required': True}, + 'product': {'required': True}, + } + + _attribute_map = { + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'product': {'key': 'product', 'type': 'str'}, + } + + def __init__( + self, + *, + publisher: str, + name: str, + product: str, + **kwargs + ): + super(PurchasePlan, self).__init__(**kwargs) + self.publisher = publisher + self.name = name + self.product = product + + +class RecoveryWalkResponse(msrest.serialization.Model): + """Response after calling a manual recovery walk. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar walk_performed: Whether the recovery walk was performed. + :vartype walk_performed: bool + :ivar next_platform_update_domain: The next update domain that needs to be walked. Null means + walk spanning all update domains has been completed. + :vartype next_platform_update_domain: int + """ + + _validation = { + 'walk_performed': {'readonly': True}, + 'next_platform_update_domain': {'readonly': True}, + } + + _attribute_map = { + 'walk_performed': {'key': 'walkPerformed', 'type': 'bool'}, + 'next_platform_update_domain': {'key': 'nextPlatformUpdateDomain', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(RecoveryWalkResponse, self).__init__(**kwargs) + self.walk_performed = None + self.next_platform_update_domain = None + + +class RequestRateByIntervalInput(LogAnalyticsInputBase): + """Api request input for LogAnalytics getRequestRateByInterval Api. + + All required parameters must be populated in order to send to Azure. + + :param blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :type blob_container_sas_uri: str + :param from_time: Required. From time of the query. + :type from_time: ~datetime.datetime + :param to_time: Required. To time of the query. + :type to_time: ~datetime.datetime + :param group_by_throttle_policy: Group query result by Throttle Policy applied. + :type group_by_throttle_policy: bool + :param group_by_operation_name: Group query result by Operation Name. + :type group_by_operation_name: bool + :param group_by_resource_name: Group query result by Resource Name. + :type group_by_resource_name: bool + :param group_by_client_application_id: Group query result by Client Application ID. + :type group_by_client_application_id: bool + :param group_by_user_agent: Group query result by User Agent. + :type group_by_user_agent: bool + :param interval_length: Required. Interval value in minutes used to create LogAnalytics call + rate logs. Possible values include: "ThreeMins", "FiveMins", "ThirtyMins", "SixtyMins". + :type interval_length: str or ~azure.mgmt.compute.v2021_03_01.models.IntervalInMins + """ + + _validation = { + 'blob_container_sas_uri': {'required': True}, + 'from_time': {'required': True}, + 'to_time': {'required': True}, + 'interval_length': {'required': True}, + } + + _attribute_map = { + 'blob_container_sas_uri': {'key': 'blobContainerSasUri', 'type': 'str'}, + 'from_time': {'key': 'fromTime', 'type': 'iso-8601'}, + 'to_time': {'key': 'toTime', 'type': 'iso-8601'}, + 'group_by_throttle_policy': {'key': 'groupByThrottlePolicy', 'type': 'bool'}, + 'group_by_operation_name': {'key': 'groupByOperationName', 'type': 'bool'}, + 'group_by_resource_name': {'key': 'groupByResourceName', 'type': 'bool'}, + 'group_by_client_application_id': {'key': 'groupByClientApplicationId', 'type': 'bool'}, + 'group_by_user_agent': {'key': 'groupByUserAgent', 'type': 'bool'}, + 'interval_length': {'key': 'intervalLength', 'type': 'str'}, + } + + def __init__( + self, + *, + blob_container_sas_uri: str, + from_time: datetime.datetime, + to_time: datetime.datetime, + interval_length: Union[str, "IntervalInMins"], + group_by_throttle_policy: Optional[bool] = None, + group_by_operation_name: Optional[bool] = None, + group_by_resource_name: Optional[bool] = None, + group_by_client_application_id: Optional[bool] = None, + group_by_user_agent: Optional[bool] = None, + **kwargs + ): + super(RequestRateByIntervalInput, self).__init__(blob_container_sas_uri=blob_container_sas_uri, from_time=from_time, to_time=to_time, group_by_throttle_policy=group_by_throttle_policy, group_by_operation_name=group_by_operation_name, group_by_resource_name=group_by_resource_name, group_by_client_application_id=group_by_client_application_id, group_by_user_agent=group_by_user_agent, **kwargs) + self.interval_length = interval_length + + +class ResourceInstanceViewStatus(msrest.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 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 + :param level: The level code. Possible values include: "Info", "Warning", "Error". + :type level: str or ~azure.mgmt.compute.v2021_03_01.models.StatusLevelTypes + """ + + _validation = { + 'code': {'readonly': True}, + 'display_status': {'readonly': True}, + 'message': {'readonly': True}, + 'time': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'display_status': {'key': 'displayStatus', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'time': {'key': 'time', 'type': 'iso-8601'}, + 'level': {'key': 'level', 'type': 'str'}, + } + + def __init__( + self, + *, + level: Optional[Union[str, "StatusLevelTypes"]] = None, + **kwargs + ): + super(ResourceInstanceViewStatus, self).__init__(**kwargs) + self.code = None + self.display_status = None + self.message = None + self.time = None + self.level = level + + +class RetrieveBootDiagnosticsDataResult(msrest.serialization.Model): + """The SAS URIs of the console screenshot and serial log blobs. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar console_screenshot_blob_uri: The console screenshot blob URI. + :vartype console_screenshot_blob_uri: str + :ivar serial_console_log_blob_uri: The serial console log blob URI. + :vartype serial_console_log_blob_uri: str + """ + + _validation = { + 'console_screenshot_blob_uri': {'readonly': True}, + 'serial_console_log_blob_uri': {'readonly': True}, + } + + _attribute_map = { + 'console_screenshot_blob_uri': {'key': 'consoleScreenshotBlobUri', 'type': 'str'}, + 'serial_console_log_blob_uri': {'key': 'serialConsoleLogBlobUri', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RetrieveBootDiagnosticsDataResult, self).__init__(**kwargs) + self.console_screenshot_blob_uri = None + self.serial_console_log_blob_uri = None + + +class RoleInstance(msrest.serialization.Model): + """RoleInstance. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource Name. + :vartype name: str + :ivar type: Resource Type. + :vartype type: str + :ivar location: Resource Location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :param sku: + :type sku: ~azure.mgmt.compute.v2021_03_01.models.InstanceSku + :param properties: + :type properties: ~azure.mgmt.compute.v2021_03_01.models.RoleInstanceProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'InstanceSku'}, + 'properties': {'key': 'properties', 'type': 'RoleInstanceProperties'}, + } + + def __init__( + self, + *, + sku: Optional["InstanceSku"] = None, + properties: Optional["RoleInstanceProperties"] = None, + **kwargs + ): + super(RoleInstance, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = None + self.tags = None + self.sku = sku + self.properties = properties + + +class RoleInstanceListResult(msrest.serialization.Model): + """RoleInstanceListResult. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.RoleInstance] + :param next_link: + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[RoleInstance]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["RoleInstance"], + next_link: Optional[str] = None, + **kwargs + ): + super(RoleInstanceListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class RoleInstanceNetworkProfile(msrest.serialization.Model): + """Describes the network profile for the role instance. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar network_interfaces: Specifies the list of resource Ids for the network interfaces + associated with the role instance. + :vartype network_interfaces: list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + """ + + _validation = { + 'network_interfaces': {'readonly': True}, + } + + _attribute_map = { + 'network_interfaces': {'key': 'networkInterfaces', 'type': '[SubResource]'}, + } + + def __init__( + self, + **kwargs + ): + super(RoleInstanceNetworkProfile, self).__init__(**kwargs) + self.network_interfaces = None + + +class RoleInstanceProperties(msrest.serialization.Model): + """RoleInstanceProperties. + + :param network_profile: Describes the network profile for the role instance. + :type network_profile: ~azure.mgmt.compute.v2021_03_01.models.RoleInstanceNetworkProfile + :param instance_view: The instance view of the role instance. + :type instance_view: ~azure.mgmt.compute.v2021_03_01.models.RoleInstanceView + """ + + _attribute_map = { + 'network_profile': {'key': 'networkProfile', 'type': 'RoleInstanceNetworkProfile'}, + 'instance_view': {'key': 'instanceView', 'type': 'RoleInstanceView'}, + } + + def __init__( + self, + *, + network_profile: Optional["RoleInstanceNetworkProfile"] = None, + instance_view: Optional["RoleInstanceView"] = None, + **kwargs + ): + super(RoleInstanceProperties, self).__init__(**kwargs) + self.network_profile = network_profile + self.instance_view = instance_view + + +class RoleInstances(msrest.serialization.Model): + """Specifies a list of role instances from the cloud service. + + All required parameters must be populated in order to send to Azure. + + :param role_instances: Required. List of cloud service role instance names. Value of '*' will + signify all role instances of the cloud service. + :type role_instances: list[str] + """ + + _validation = { + 'role_instances': {'required': True}, + } + + _attribute_map = { + 'role_instances': {'key': 'roleInstances', 'type': '[str]'}, + } + + def __init__( + self, + *, + role_instances: List[str], + **kwargs + ): + super(RoleInstances, self).__init__(**kwargs) + self.role_instances = role_instances + + +class RoleInstanceView(msrest.serialization.Model): + """The instance view of the role instance. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar platform_update_domain: The Update Domain. + :vartype platform_update_domain: int + :ivar platform_fault_domain: The Fault Domain. + :vartype platform_fault_domain: int + :ivar private_id: Specifies a unique identifier generated internally for the cloud service + associated with this role instance. :code:`
    `:code:`
    ` NOTE: If you are using Azure + Diagnostics extension, this property can be used as 'DeploymentId' for querying details. + :vartype private_id: str + :ivar statuses: + :vartype statuses: list[~azure.mgmt.compute.v2021_03_01.models.ResourceInstanceViewStatus] + """ + + _validation = { + 'platform_update_domain': {'readonly': True}, + 'platform_fault_domain': {'readonly': True}, + 'private_id': {'readonly': True}, + 'statuses': {'readonly': True}, + } + + _attribute_map = { + 'platform_update_domain': {'key': 'platformUpdateDomain', 'type': 'int'}, + 'platform_fault_domain': {'key': 'platformFaultDomain', 'type': 'int'}, + 'private_id': {'key': 'privateId', 'type': 'str'}, + 'statuses': {'key': 'statuses', 'type': '[ResourceInstanceViewStatus]'}, + } + + def __init__( + self, + **kwargs + ): + super(RoleInstanceView, self).__init__(**kwargs) + self.platform_update_domain = None + self.platform_fault_domain = None + self.private_id = None + self.statuses = None + + +class RollbackStatusInfo(msrest.serialization.Model): + """Information about rollback on failed VM instances after a OS Upgrade operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar successfully_rolledback_instance_count: The number of instances which have been + successfully rolled back. + :vartype successfully_rolledback_instance_count: int + :ivar failed_rolledback_instance_count: The number of instances which failed to rollback. + :vartype failed_rolledback_instance_count: int + :ivar rollback_error: Error details if OS rollback failed. + :vartype rollback_error: ~azure.mgmt.compute.v2021_03_01.models.ApiError + """ + + _validation = { + 'successfully_rolledback_instance_count': {'readonly': True}, + 'failed_rolledback_instance_count': {'readonly': True}, + 'rollback_error': {'readonly': True}, + } + + _attribute_map = { + 'successfully_rolledback_instance_count': {'key': 'successfullyRolledbackInstanceCount', 'type': 'int'}, + 'failed_rolledback_instance_count': {'key': 'failedRolledbackInstanceCount', 'type': 'int'}, + 'rollback_error': {'key': 'rollbackError', 'type': 'ApiError'}, + } + + def __init__( + self, + **kwargs + ): + super(RollbackStatusInfo, self).__init__(**kwargs) + self.successfully_rolledback_instance_count = None + self.failed_rolledback_instance_count = None + self.rollback_error = None + + +class RollingUpgradePolicy(msrest.serialization.Model): + """The configuration parameters used while performing a rolling upgrade. + + :param max_batch_instance_percent: The maximum percent of total virtual machine instances that + will be upgraded simultaneously by the rolling upgrade in one batch. As this is a maximum, + unhealthy instances in previous or future batches can cause the percentage of instances in a + batch to decrease to ensure higher reliability. The default value for this parameter is 20%. + :type max_batch_instance_percent: int + :param max_unhealthy_instance_percent: The maximum percentage of the total virtual machine + instances in the scale set that can be simultaneously unhealthy, either as a result of being + upgraded, or by being found in an unhealthy state by the virtual machine health checks before + the rolling upgrade aborts. This constraint will be checked prior to starting any batch. The + default value for this parameter is 20%. + :type max_unhealthy_instance_percent: int + :param max_unhealthy_upgraded_instance_percent: The maximum percentage of upgraded virtual + machine instances that can be found to be in an unhealthy state. This check will happen after + each batch is upgraded. If this percentage is ever exceeded, the rolling update aborts. The + default value for this parameter is 20%. + :type max_unhealthy_upgraded_instance_percent: int + :param pause_time_between_batches: The wait time between completing the update for all virtual + machines in one batch and starting the next batch. The time duration should be specified in ISO + 8601 format. The default value is 0 seconds (PT0S). + :type pause_time_between_batches: str + :param enable_cross_zone_upgrade: Allow VMSS to ignore AZ boundaries when constructing upgrade + batches. Take into consideration the Update Domain and maxBatchInstancePercent to determine the + batch size. + :type enable_cross_zone_upgrade: bool + :param prioritize_unhealthy_instances: Upgrade all unhealthy instances in a scale set before + any healthy instances. + :type prioritize_unhealthy_instances: bool + """ + + _validation = { + 'max_batch_instance_percent': {'maximum': 100, 'minimum': 5}, + 'max_unhealthy_instance_percent': {'maximum': 100, 'minimum': 5}, + 'max_unhealthy_upgraded_instance_percent': {'maximum': 100, 'minimum': 0}, + } + + _attribute_map = { + 'max_batch_instance_percent': {'key': 'maxBatchInstancePercent', 'type': 'int'}, + 'max_unhealthy_instance_percent': {'key': 'maxUnhealthyInstancePercent', 'type': 'int'}, + 'max_unhealthy_upgraded_instance_percent': {'key': 'maxUnhealthyUpgradedInstancePercent', 'type': 'int'}, + 'pause_time_between_batches': {'key': 'pauseTimeBetweenBatches', 'type': 'str'}, + 'enable_cross_zone_upgrade': {'key': 'enableCrossZoneUpgrade', 'type': 'bool'}, + 'prioritize_unhealthy_instances': {'key': 'prioritizeUnhealthyInstances', 'type': 'bool'}, + } + + def __init__( + self, + *, + max_batch_instance_percent: Optional[int] = None, + max_unhealthy_instance_percent: Optional[int] = None, + max_unhealthy_upgraded_instance_percent: Optional[int] = None, + pause_time_between_batches: Optional[str] = None, + enable_cross_zone_upgrade: Optional[bool] = None, + prioritize_unhealthy_instances: Optional[bool] = None, + **kwargs + ): + super(RollingUpgradePolicy, self).__init__(**kwargs) + self.max_batch_instance_percent = max_batch_instance_percent + self.max_unhealthy_instance_percent = max_unhealthy_instance_percent + self.max_unhealthy_upgraded_instance_percent = max_unhealthy_upgraded_instance_percent + self.pause_time_between_batches = pause_time_between_batches + self.enable_cross_zone_upgrade = enable_cross_zone_upgrade + self.prioritize_unhealthy_instances = prioritize_unhealthy_instances + + +class RollingUpgradeProgressInfo(msrest.serialization.Model): + """Information about the number of virtual machine instances in each upgrade state. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar successful_instance_count: The number of instances that have been successfully upgraded. + :vartype successful_instance_count: int + :ivar failed_instance_count: The number of instances that have failed to be upgraded + successfully. + :vartype failed_instance_count: int + :ivar in_progress_instance_count: The number of instances that are currently being upgraded. + :vartype in_progress_instance_count: int + :ivar pending_instance_count: The number of instances that have not yet begun to be upgraded. + :vartype pending_instance_count: int + """ + + _validation = { + 'successful_instance_count': {'readonly': True}, + 'failed_instance_count': {'readonly': True}, + 'in_progress_instance_count': {'readonly': True}, + 'pending_instance_count': {'readonly': True}, + } + + _attribute_map = { + 'successful_instance_count': {'key': 'successfulInstanceCount', 'type': 'int'}, + 'failed_instance_count': {'key': 'failedInstanceCount', 'type': 'int'}, + 'in_progress_instance_count': {'key': 'inProgressInstanceCount', 'type': 'int'}, + 'pending_instance_count': {'key': 'pendingInstanceCount', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(RollingUpgradeProgressInfo, self).__init__(**kwargs) + self.successful_instance_count = None + self.failed_instance_count = None + self.in_progress_instance_count = None + self.pending_instance_count = None + + +class RollingUpgradeRunningStatus(msrest.serialization.Model): + """Information about the current running state of the overall upgrade. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Code indicating the current status of the upgrade. Possible values include: + "RollingForward", "Cancelled", "Completed", "Faulted". + :vartype code: str or ~azure.mgmt.compute.v2021_03_01.models.RollingUpgradeStatusCode + :ivar start_time: Start time of the upgrade. + :vartype start_time: ~datetime.datetime + :ivar last_action: The last action performed on the rolling upgrade. Possible values include: + "Start", "Cancel". + :vartype last_action: str or ~azure.mgmt.compute.v2021_03_01.models.RollingUpgradeActionType + :ivar last_action_time: Last action time of the upgrade. + :vartype last_action_time: ~datetime.datetime + """ + + _validation = { + 'code': {'readonly': True}, + 'start_time': {'readonly': True}, + 'last_action': {'readonly': True}, + 'last_action_time': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'last_action': {'key': 'lastAction', 'type': 'str'}, + 'last_action_time': {'key': 'lastActionTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(RollingUpgradeRunningStatus, self).__init__(**kwargs) + self.code = None + self.start_time = None + self.last_action = None + self.last_action_time = None + + +class RollingUpgradeStatusInfo(Resource): + """The status of the latest virtual machine scale set rolling upgrade. + + 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 id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :ivar policy: The rolling upgrade policies applied for this upgrade. + :vartype policy: ~azure.mgmt.compute.v2021_03_01.models.RollingUpgradePolicy + :ivar running_status: Information about the current running state of the overall upgrade. + :vartype running_status: ~azure.mgmt.compute.v2021_03_01.models.RollingUpgradeRunningStatus + :ivar progress: Information about the number of virtual machine instances in each upgrade + state. + :vartype progress: ~azure.mgmt.compute.v2021_03_01.models.RollingUpgradeProgressInfo + :ivar error: Error details for this upgrade, if there are any. + :vartype error: ~azure.mgmt.compute.v2021_03_01.models.ApiError + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'policy': {'readonly': True}, + 'running_status': {'readonly': True}, + 'progress': {'readonly': True}, + 'error': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'policy': {'key': 'properties.policy', 'type': 'RollingUpgradePolicy'}, + 'running_status': {'key': 'properties.runningStatus', 'type': 'RollingUpgradeRunningStatus'}, + 'progress': {'key': 'properties.progress', 'type': 'RollingUpgradeProgressInfo'}, + 'error': {'key': 'properties.error', 'type': 'ApiError'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(RollingUpgradeStatusInfo, self).__init__(location=location, tags=tags, **kwargs) + self.policy = None + self.running_status = None + self.progress = None + self.error = None + + +class RunCommandDocumentBase(msrest.serialization.Model): + """Describes the properties of a Run Command metadata. + + All required parameters must be populated in order to send to Azure. + + :param schema: Required. The VM run command schema. + :type schema: str + :param id: Required. The VM run command id. + :type id: str + :param os_type: Required. The Operating System type. Possible values include: "Windows", + "Linux". + :type os_type: str or ~azure.mgmt.compute.v2021_03_01.models.OperatingSystemTypes + :param label: Required. The VM run command label. + :type label: str + :param description: Required. The VM run command description. + :type description: str + """ + + _validation = { + 'schema': {'required': True}, + 'id': {'required': True}, + 'os_type': {'required': True}, + 'label': {'required': True}, + 'description': {'required': True}, + } + + _attribute_map = { + 'schema': {'key': '$schema', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'os_type': {'key': 'osType', 'type': 'str'}, + 'label': {'key': 'label', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + schema: str, + id: str, + os_type: Union[str, "OperatingSystemTypes"], + label: str, + description: str, + **kwargs + ): + super(RunCommandDocumentBase, self).__init__(**kwargs) + self.schema = schema + self.id = id + self.os_type = os_type + self.label = label + self.description = description + + +class RunCommandDocument(RunCommandDocumentBase): + """Describes the properties of a Run Command. + + All required parameters must be populated in order to send to Azure. + + :param schema: Required. The VM run command schema. + :type schema: str + :param id: Required. The VM run command id. + :type id: str + :param os_type: Required. The Operating System type. Possible values include: "Windows", + "Linux". + :type os_type: str or ~azure.mgmt.compute.v2021_03_01.models.OperatingSystemTypes + :param label: Required. The VM run command label. + :type label: str + :param description: Required. The VM run command description. + :type description: str + :param script: Required. The script to be executed. + :type script: list[str] + :param parameters: The parameters used by the script. + :type parameters: list[~azure.mgmt.compute.v2021_03_01.models.RunCommandParameterDefinition] + """ + + _validation = { + 'schema': {'required': True}, + 'id': {'required': True}, + 'os_type': {'required': True}, + 'label': {'required': True}, + 'description': {'required': True}, + 'script': {'required': True}, + } + + _attribute_map = { + 'schema': {'key': '$schema', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'os_type': {'key': 'osType', 'type': 'str'}, + 'label': {'key': 'label', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'script': {'key': 'script', 'type': '[str]'}, + 'parameters': {'key': 'parameters', 'type': '[RunCommandParameterDefinition]'}, + } + + def __init__( + self, + *, + schema: str, + id: str, + os_type: Union[str, "OperatingSystemTypes"], + label: str, + description: str, + script: List[str], + parameters: Optional[List["RunCommandParameterDefinition"]] = None, + **kwargs + ): + super(RunCommandDocument, self).__init__(schema=schema, id=id, os_type=os_type, label=label, description=description, **kwargs) + self.script = script + self.parameters = parameters + + +class RunCommandInput(msrest.serialization.Model): + """Capture Virtual Machine parameters. + + All required parameters must be populated in order to send to Azure. + + :param command_id: Required. The run command id. + :type command_id: str + :param script: Optional. The script to be executed. When this value is given, the given script + will override the default script of the command. + :type script: list[str] + :param parameters: The run command parameters. + :type parameters: list[~azure.mgmt.compute.v2021_03_01.models.RunCommandInputParameter] + """ + + _validation = { + 'command_id': {'required': True}, + } + + _attribute_map = { + 'command_id': {'key': 'commandId', 'type': 'str'}, + 'script': {'key': 'script', 'type': '[str]'}, + 'parameters': {'key': 'parameters', 'type': '[RunCommandInputParameter]'}, + } + + def __init__( + self, + *, + command_id: str, + script: Optional[List[str]] = None, + parameters: Optional[List["RunCommandInputParameter"]] = None, + **kwargs + ): + super(RunCommandInput, self).__init__(**kwargs) + self.command_id = command_id + self.script = script + self.parameters = parameters + + +class RunCommandInputParameter(msrest.serialization.Model): + """Describes the properties of a run command parameter. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The run command parameter name. + :type name: str + :param value: Required. The run command parameter value. + :type value: str + """ + + _validation = { + 'name': {'required': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + value: str, + **kwargs + ): + super(RunCommandInputParameter, self).__init__(**kwargs) + self.name = name + self.value = value + + +class RunCommandListResult(msrest.serialization.Model): + """The List Virtual Machine operation response. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. The list of virtual machine run commands. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.RunCommandDocumentBase] + :param next_link: The uri to fetch the next page of run commands. Call ListNext() with this to + fetch the next page of run commands. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[RunCommandDocumentBase]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["RunCommandDocumentBase"], + next_link: Optional[str] = None, + **kwargs + ): + super(RunCommandListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class RunCommandParameterDefinition(msrest.serialization.Model): + """Describes the properties of a run command parameter. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The run command parameter name. + :type name: str + :param type: Required. The run command parameter type. + :type type: str + :param default_value: The run command parameter default value. + :type default_value: str + :param required: The run command parameter required. + :type required: bool + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'default_value': {'key': 'defaultValue', 'type': 'str'}, + 'required': {'key': 'required', 'type': 'bool'}, + } + + def __init__( + self, + *, + name: str, + type: str, + default_value: Optional[str] = None, + required: Optional[bool] = False, + **kwargs + ): + super(RunCommandParameterDefinition, self).__init__(**kwargs) + self.name = name + self.type = type + self.default_value = default_value + self.required = required + + +class RunCommandResult(msrest.serialization.Model): + """RunCommandResult. + + :param value: Run command operation response. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[InstanceViewStatus]'}, + } + + def __init__( + self, + *, + value: Optional[List["InstanceViewStatus"]] = None, + **kwargs + ): + super(RunCommandResult, self).__init__(**kwargs) + self.value = value + + +class ScaleInPolicy(msrest.serialization.Model): + """Describes a scale-in policy for a virtual machine scale set. + + :param rules: The rules to be followed when scaling-in a virtual machine scale set. + :code:`
    `:code:`
    ` Possible values are: :code:`
    `:code:`
    ` **Default** When a + virtual machine scale set is scaled in, the scale set will first be balanced across zones if it + is a zonal scale set. Then, it will be balanced across Fault Domains as far as possible. Within + each Fault Domain, the virtual machines chosen for removal will be the newest ones that are not + protected from scale-in. :code:`
    `:code:`
    ` **OldestVM** When a virtual machine scale set + is being scaled-in, the oldest virtual machines that are not protected from scale-in will be + chosen for removal. For zonal virtual machine scale sets, the scale set will first be balanced + across zones. Within each zone, the oldest virtual machines that are not protected will be + chosen for removal. :code:`
    `:code:`
    ` **NewestVM** When a virtual machine scale set is + being scaled-in, the newest virtual machines that are not protected from scale-in will be + chosen for removal. For zonal virtual machine scale sets, the scale set will first be balanced + across zones. Within each zone, the newest virtual machines that are not protected will be + chosen for removal. :code:`
    `:code:`
    `. + :type rules: list[str or + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetScaleInRules] + """ + + _attribute_map = { + 'rules': {'key': 'rules', 'type': '[str]'}, + } + + def __init__( + self, + *, + rules: Optional[List[Union[str, "VirtualMachineScaleSetScaleInRules"]]] = None, + **kwargs + ): + super(ScaleInPolicy, self).__init__(**kwargs) + self.rules = rules + + +class ScheduledEventsProfile(msrest.serialization.Model): + """ScheduledEventsProfile. + + :param terminate_notification_profile: Specifies Terminate Scheduled Event related + configurations. + :type terminate_notification_profile: + ~azure.mgmt.compute.v2021_03_01.models.TerminateNotificationProfile + """ + + _attribute_map = { + 'terminate_notification_profile': {'key': 'terminateNotificationProfile', 'type': 'TerminateNotificationProfile'}, + } + + def __init__( + self, + *, + terminate_notification_profile: Optional["TerminateNotificationProfile"] = None, + **kwargs + ): + super(ScheduledEventsProfile, self).__init__(**kwargs) + self.terminate_notification_profile = terminate_notification_profile + + +class SecurityProfile(msrest.serialization.Model): + """Specifies the Security profile settings for the virtual machine or virtual machine scale set. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param uefi_settings: Specifies the security settings like secure boot and vTPM used while + creating the virtual machine. :code:`
    `:code:`
    `Minimum api-version: 2020-12-01. + :type uefi_settings: ~azure.mgmt.compute.v2021_03_01.models.UefiSettings + :param encryption_at_host: This property can be used by user in the request to enable or + disable the Host Encryption for the virtual machine or virtual machine scale set. This will + enable the encryption for all the disks including Resource/Temp disk at host itself. + :code:`
    `:code:`
    ` Default: The Encryption at host will be disabled unless this property + is set to true for the resource. + :type encryption_at_host: bool + :ivar security_type: Specifies the SecurityType of the virtual machine. It is set as + TrustedLaunch to enable UefiSettings. :code:`
    `:code:`
    ` Default: UefiSettings will not + be enabled unless this property is set as TrustedLaunch. Default value: "TrustedLaunch". + :vartype security_type: str + """ + + _validation = { + 'security_type': {'constant': True}, + } + + _attribute_map = { + 'uefi_settings': {'key': 'uefiSettings', 'type': 'UefiSettings'}, + 'encryption_at_host': {'key': 'encryptionAtHost', 'type': 'bool'}, + 'security_type': {'key': 'securityType', 'type': 'str'}, + } + + security_type = "TrustedLaunch" + + def __init__( + self, + *, + uefi_settings: Optional["UefiSettings"] = None, + encryption_at_host: Optional[bool] = None, + **kwargs + ): + super(SecurityProfile, self).__init__(**kwargs) + self.uefi_settings = uefi_settings + self.encryption_at_host = encryption_at_host + + +class Sku(msrest.serialization.Model): + """Describes a virtual machine scale set sku. NOTE: If the new VM SKU is not supported on the hardware the scale set is currently on, you need to deallocate the VMs in the scale set before you modify the SKU name. + + :param name: The sku name. + :type name: str + :param tier: Specifies the tier of virtual machines in a scale set.:code:`
    `:code:`
    ` + Possible Values::code:`
    `:code:`
    ` **Standard**\ :code:`
    `:code:`
    ` + **Basic**. + :type tier: str + :param capacity: Specifies the number of virtual machines in the scale set. + :type capacity: long + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'long'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + tier: Optional[str] = None, + capacity: Optional[int] = None, + **kwargs + ): + super(Sku, self).__init__(**kwargs) + self.name = name + self.tier = tier + self.capacity = capacity + + +class SshConfiguration(msrest.serialization.Model): + """SSH configuration for Linux based VMs running on Azure. + + :param public_keys: The list of SSH public keys used to authenticate with linux based VMs. + :type public_keys: list[~azure.mgmt.compute.v2021_03_01.models.SshPublicKey] + """ + + _attribute_map = { + 'public_keys': {'key': 'publicKeys', 'type': '[SshPublicKey]'}, + } + + def __init__( + self, + *, + public_keys: Optional[List["SshPublicKey"]] = None, + **kwargs + ): + super(SshConfiguration, self).__init__(**kwargs) + self.public_keys = public_keys + + +class SshPublicKey(msrest.serialization.Model): + """Contains information about SSH certificate public key and the path on the Linux VM where the public key is placed. + + :param path: Specifies the full path on the created VM where ssh public key is stored. If the + file already exists, the specified key is appended to the file. Example: + /home/user/.ssh/authorized_keys. + :type path: str + :param key_data: SSH public key certificate used to authenticate with the VM through ssh. The + key needs to be at least 2048-bit and in ssh-rsa format. :code:`
    `:code:`
    ` For creating + ssh keys, see `Create SSH keys on Linux and Mac for Linux VMs in Azure + `_. + :type key_data: str + """ + + _attribute_map = { + 'path': {'key': 'path', 'type': 'str'}, + 'key_data': {'key': 'keyData', 'type': 'str'}, + } + + def __init__( + self, + *, + path: Optional[str] = None, + key_data: Optional[str] = None, + **kwargs + ): + super(SshPublicKey, self).__init__(**kwargs) + self.path = path + self.key_data = key_data + + +class SshPublicKeyGenerateKeyPairResult(msrest.serialization.Model): + """Response from generation of an SSH key pair. + + All required parameters must be populated in order to send to Azure. + + :param private_key: Required. Private key portion of the key pair used to authenticate to a + virtual machine through ssh. The private key is returned in RFC3447 format and should be + treated as a secret. + :type private_key: str + :param public_key: Required. Public key portion of the key pair used to authenticate to a + virtual machine through ssh. The public key is in ssh-rsa format. + :type public_key: str + :param id: Required. The ARM resource id in the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. + :type id: str + """ + + _validation = { + 'private_key': {'required': True}, + 'public_key': {'required': True}, + 'id': {'required': True}, + } + + _attribute_map = { + 'private_key': {'key': 'privateKey', 'type': 'str'}, + 'public_key': {'key': 'publicKey', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + private_key: str, + public_key: str, + id: str, + **kwargs + ): + super(SshPublicKeyGenerateKeyPairResult, self).__init__(**kwargs) + self.private_key = private_key + self.public_key = public_key + self.id = id + + +class SshPublicKeyResource(Resource): + """Specifies information about the SSH public key. + + 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 id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param public_key: SSH public key used to authenticate to a virtual machine through ssh. If + this property is not initially provided when the resource is created, the publicKey property + will be populated when generateKeyPair is called. If the public key is provided upon resource + creation, the provided public key needs to be at least 2048-bit and in ssh-rsa format. + :type public_key: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'public_key': {'key': 'properties.publicKey', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + public_key: Optional[str] = None, + **kwargs + ): + super(SshPublicKeyResource, self).__init__(location=location, tags=tags, **kwargs) + self.public_key = public_key + + +class SshPublicKeysGroupListResult(msrest.serialization.Model): + """The list SSH public keys operation response. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. The list of SSH public keys. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.SshPublicKeyResource] + :param next_link: The URI to fetch the next page of SSH public keys. Call ListNext() with this + URI to fetch the next page of SSH public keys. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SshPublicKeyResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["SshPublicKeyResource"], + next_link: Optional[str] = None, + **kwargs + ): + super(SshPublicKeysGroupListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SshPublicKeyUpdateResource(UpdateResource): + """Specifies information about the SSH public key. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param public_key: SSH public key used to authenticate to a virtual machine through ssh. If + this property is not initially provided when the resource is created, the publicKey property + will be populated when generateKeyPair is called. If the public key is provided upon resource + creation, the provided public key needs to be at least 2048-bit and in ssh-rsa format. + :type public_key: str + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'public_key': {'key': 'properties.publicKey', 'type': 'str'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + public_key: Optional[str] = None, + **kwargs + ): + super(SshPublicKeyUpdateResource, self).__init__(tags=tags, **kwargs) + self.public_key = public_key + + +class StatusCodeCount(msrest.serialization.Model): + """StatusCodeCount. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The instance view status code. + :vartype code: str + :ivar count: Number of instances having this status code. + :vartype count: int + """ + + _validation = { + 'code': {'readonly': True}, + 'count': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'count': {'key': 'count', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(StatusCodeCount, self).__init__(**kwargs) + self.code = None + self.count = None + + +class StorageProfile(msrest.serialization.Model): + """Specifies the storage settings for the virtual machine disks. + + :param image_reference: Specifies information about the image to use. You can specify + information about platform images, marketplace images, or virtual machine images. This element + is required when you want to use a platform image, marketplace image, or virtual machine image, + but is not used in other creation operations. + :type image_reference: ~azure.mgmt.compute.v2021_03_01.models.ImageReference + :param os_disk: Specifies information about the operating system disk used by the virtual + machine. :code:`
    `:code:`
    ` For more information about disks, see `About disks and VHDs + for Azure virtual machines `_. + :type os_disk: ~azure.mgmt.compute.v2021_03_01.models.OSDisk + :param data_disks: Specifies the parameters that are used to add a data disk to a virtual + machine. :code:`
    `:code:`
    ` For more information about disks, see `About disks and VHDs + for Azure virtual machines `_. + :type data_disks: list[~azure.mgmt.compute.v2021_03_01.models.DataDisk] + """ + + _attribute_map = { + 'image_reference': {'key': 'imageReference', 'type': 'ImageReference'}, + 'os_disk': {'key': 'osDisk', 'type': 'OSDisk'}, + 'data_disks': {'key': 'dataDisks', 'type': '[DataDisk]'}, + } + + def __init__( + self, + *, + image_reference: Optional["ImageReference"] = None, + os_disk: Optional["OSDisk"] = None, + data_disks: Optional[List["DataDisk"]] = None, + **kwargs + ): + super(StorageProfile, self).__init__(**kwargs) + self.image_reference = image_reference + self.os_disk = os_disk + self.data_disks = data_disks + + +class SubResourceReadOnly(msrest.serialization.Model): + """SubResourceReadOnly. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SubResourceReadOnly, self).__init__(**kwargs) + self.id = None + + +class SubResourceWithColocationStatus(SubResource): + """SubResourceWithColocationStatus. + + :param id: Resource Id. + :type id: str + :param colocation_status: Describes colocation status of a resource in the Proximity Placement + Group. + :type colocation_status: ~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'colocation_status': {'key': 'colocationStatus', 'type': 'InstanceViewStatus'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + colocation_status: Optional["InstanceViewStatus"] = None, + **kwargs + ): + super(SubResourceWithColocationStatus, self).__init__(id=id, **kwargs) + self.colocation_status = colocation_status + + +class TerminateNotificationProfile(msrest.serialization.Model): + """TerminateNotificationProfile. + + :param not_before_timeout: Configurable length of time a Virtual Machine being deleted will + have to potentially approve the Terminate Scheduled Event before the event is auto approved + (timed out). The configuration must be specified in ISO 8601 format, the default value is 5 + minutes (PT5M). + :type not_before_timeout: str + :param enable: Specifies whether the Terminate Scheduled event is enabled or disabled. + :type enable: bool + """ + + _attribute_map = { + 'not_before_timeout': {'key': 'notBeforeTimeout', 'type': 'str'}, + 'enable': {'key': 'enable', 'type': 'bool'}, + } + + def __init__( + self, + *, + not_before_timeout: Optional[str] = None, + enable: Optional[bool] = None, + **kwargs + ): + super(TerminateNotificationProfile, self).__init__(**kwargs) + self.not_before_timeout = not_before_timeout + self.enable = enable + + +class ThrottledRequestsInput(LogAnalyticsInputBase): + """Api request input for LogAnalytics getThrottledRequests Api. + + All required parameters must be populated in order to send to Azure. + + :param blob_container_sas_uri: Required. SAS Uri of the logging blob container to which + LogAnalytics Api writes output logs to. + :type blob_container_sas_uri: str + :param from_time: Required. From time of the query. + :type from_time: ~datetime.datetime + :param to_time: Required. To time of the query. + :type to_time: ~datetime.datetime + :param group_by_throttle_policy: Group query result by Throttle Policy applied. + :type group_by_throttle_policy: bool + :param group_by_operation_name: Group query result by Operation Name. + :type group_by_operation_name: bool + :param group_by_resource_name: Group query result by Resource Name. + :type group_by_resource_name: bool + :param group_by_client_application_id: Group query result by Client Application ID. + :type group_by_client_application_id: bool + :param group_by_user_agent: Group query result by User Agent. + :type group_by_user_agent: bool + """ + + _validation = { + 'blob_container_sas_uri': {'required': True}, + 'from_time': {'required': True}, + 'to_time': {'required': True}, + } + + _attribute_map = { + 'blob_container_sas_uri': {'key': 'blobContainerSasUri', 'type': 'str'}, + 'from_time': {'key': 'fromTime', 'type': 'iso-8601'}, + 'to_time': {'key': 'toTime', 'type': 'iso-8601'}, + 'group_by_throttle_policy': {'key': 'groupByThrottlePolicy', 'type': 'bool'}, + 'group_by_operation_name': {'key': 'groupByOperationName', 'type': 'bool'}, + 'group_by_resource_name': {'key': 'groupByResourceName', 'type': 'bool'}, + 'group_by_client_application_id': {'key': 'groupByClientApplicationId', 'type': 'bool'}, + 'group_by_user_agent': {'key': 'groupByUserAgent', 'type': 'bool'}, + } + + def __init__( + self, + *, + blob_container_sas_uri: str, + from_time: datetime.datetime, + to_time: datetime.datetime, + group_by_throttle_policy: Optional[bool] = None, + group_by_operation_name: Optional[bool] = None, + group_by_resource_name: Optional[bool] = None, + group_by_client_application_id: Optional[bool] = None, + group_by_user_agent: Optional[bool] = None, + **kwargs + ): + super(ThrottledRequestsInput, self).__init__(blob_container_sas_uri=blob_container_sas_uri, from_time=from_time, to_time=to_time, group_by_throttle_policy=group_by_throttle_policy, group_by_operation_name=group_by_operation_name, group_by_resource_name=group_by_resource_name, group_by_client_application_id=group_by_client_application_id, group_by_user_agent=group_by_user_agent, **kwargs) + + +class UefiSettings(msrest.serialization.Model): + """Specifies the security settings like secure boot and vTPM used while creating the virtual machine. :code:`
    `:code:`
    `Minimum api-version: 2020-12-01. + + :param secure_boot_enabled: Specifies whether secure boot should be enabled on the virtual + machine. :code:`
    `:code:`
    `Minimum api-version: 2020-12-01. + :type secure_boot_enabled: bool + :param v_tpm_enabled: Specifies whether vTPM should be enabled on the virtual machine. + :code:`
    `:code:`
    `Minimum api-version: 2020-12-01. + :type v_tpm_enabled: bool + """ + + _attribute_map = { + 'secure_boot_enabled': {'key': 'secureBootEnabled', 'type': 'bool'}, + 'v_tpm_enabled': {'key': 'vTpmEnabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + secure_boot_enabled: Optional[bool] = None, + v_tpm_enabled: Optional[bool] = None, + **kwargs + ): + super(UefiSettings, self).__init__(**kwargs) + self.secure_boot_enabled = secure_boot_enabled + self.v_tpm_enabled = v_tpm_enabled + + +class UpdateDomain(msrest.serialization.Model): + """Defines an update domain for the cloud service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource Name. + :vartype name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(UpdateDomain, self).__init__(**kwargs) + self.id = None + self.name = None + + +class UpdateDomainListResult(msrest.serialization.Model): + """UpdateDomainListResult. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.UpdateDomain] + :param next_link: + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[UpdateDomain]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["UpdateDomain"], + next_link: Optional[str] = None, + **kwargs + ): + super(UpdateDomainListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class UpgradeOperationHistoricalStatusInfo(msrest.serialization.Model): + """Virtual Machine Scale Set OS Upgrade History operation response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar properties: Information about the properties of the upgrade operation. + :vartype properties: + ~azure.mgmt.compute.v2021_03_01.models.UpgradeOperationHistoricalStatusInfoProperties + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + """ + + _validation = { + 'properties': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'UpgradeOperationHistoricalStatusInfoProperties'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(UpgradeOperationHistoricalStatusInfo, self).__init__(**kwargs) + self.properties = None + self.type = None + self.location = None + + +class UpgradeOperationHistoricalStatusInfoProperties(msrest.serialization.Model): + """Describes each OS upgrade on the Virtual Machine Scale Set. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar running_status: Information about the overall status of the upgrade operation. + :vartype running_status: ~azure.mgmt.compute.v2021_03_01.models.UpgradeOperationHistoryStatus + :ivar progress: Counts of the VMs in each state. + :vartype progress: ~azure.mgmt.compute.v2021_03_01.models.RollingUpgradeProgressInfo + :ivar error: Error Details for this upgrade if there are any. + :vartype error: ~azure.mgmt.compute.v2021_03_01.models.ApiError + :ivar started_by: Invoker of the Upgrade Operation. Possible values include: "Unknown", "User", + "Platform". + :vartype started_by: str or ~azure.mgmt.compute.v2021_03_01.models.UpgradeOperationInvoker + :ivar target_image_reference: Image Reference details. + :vartype target_image_reference: ~azure.mgmt.compute.v2021_03_01.models.ImageReference + :ivar rollback_info: Information about OS rollback if performed. + :vartype rollback_info: ~azure.mgmt.compute.v2021_03_01.models.RollbackStatusInfo + """ + + _validation = { + 'running_status': {'readonly': True}, + 'progress': {'readonly': True}, + 'error': {'readonly': True}, + 'started_by': {'readonly': True}, + 'target_image_reference': {'readonly': True}, + 'rollback_info': {'readonly': True}, + } + + _attribute_map = { + 'running_status': {'key': 'runningStatus', 'type': 'UpgradeOperationHistoryStatus'}, + 'progress': {'key': 'progress', 'type': 'RollingUpgradeProgressInfo'}, + 'error': {'key': 'error', 'type': 'ApiError'}, + 'started_by': {'key': 'startedBy', 'type': 'str'}, + 'target_image_reference': {'key': 'targetImageReference', 'type': 'ImageReference'}, + 'rollback_info': {'key': 'rollbackInfo', 'type': 'RollbackStatusInfo'}, + } + + def __init__( + self, + **kwargs + ): + super(UpgradeOperationHistoricalStatusInfoProperties, self).__init__(**kwargs) + self.running_status = None + self.progress = None + self.error = None + self.started_by = None + self.target_image_reference = None + self.rollback_info = None + + +class UpgradeOperationHistoryStatus(msrest.serialization.Model): + """Information about the current running state of the overall upgrade. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Code indicating the current status of the upgrade. Possible values include: + "RollingForward", "Cancelled", "Completed", "Faulted". + :vartype code: str or ~azure.mgmt.compute.v2021_03_01.models.UpgradeState + :ivar start_time: Start time of the upgrade. + :vartype start_time: ~datetime.datetime + :ivar end_time: End time of the upgrade. + :vartype end_time: ~datetime.datetime + """ + + _validation = { + 'code': {'readonly': True}, + 'start_time': {'readonly': True}, + 'end_time': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(UpgradeOperationHistoryStatus, self).__init__(**kwargs) + self.code = None + self.start_time = None + self.end_time = None + + +class UpgradePolicy(msrest.serialization.Model): + """Describes an upgrade policy - automatic, manual, or rolling. + + :param mode: Specifies the mode of an upgrade to virtual machines in the scale set.:code:`
    `:code:`
    ` Possible values are::code:`
    `:code:`
    ` **Manual** - You control + the application of updates to virtual machines in the scale set. You do this by using the + manualUpgrade action.:code:`
    `:code:`
    ` **Automatic** - All virtual machines in the + scale set are automatically updated at the same time. Possible values include: "Automatic", + "Manual", "Rolling". + :type mode: str or ~azure.mgmt.compute.v2021_03_01.models.UpgradeMode + :param rolling_upgrade_policy: The configuration parameters used while performing a rolling + upgrade. + :type rolling_upgrade_policy: ~azure.mgmt.compute.v2021_03_01.models.RollingUpgradePolicy + :param automatic_os_upgrade_policy: Configuration parameters used for performing automatic OS + Upgrade. + :type automatic_os_upgrade_policy: + ~azure.mgmt.compute.v2021_03_01.models.AutomaticOSUpgradePolicy + """ + + _attribute_map = { + 'mode': {'key': 'mode', 'type': 'str'}, + 'rolling_upgrade_policy': {'key': 'rollingUpgradePolicy', 'type': 'RollingUpgradePolicy'}, + 'automatic_os_upgrade_policy': {'key': 'automaticOSUpgradePolicy', 'type': 'AutomaticOSUpgradePolicy'}, + } + + def __init__( + self, + *, + mode: Optional[Union[str, "UpgradeMode"]] = None, + rolling_upgrade_policy: Optional["RollingUpgradePolicy"] = None, + automatic_os_upgrade_policy: Optional["AutomaticOSUpgradePolicy"] = None, + **kwargs + ): + super(UpgradePolicy, self).__init__(**kwargs) + self.mode = mode + self.rolling_upgrade_policy = rolling_upgrade_policy + self.automatic_os_upgrade_policy = automatic_os_upgrade_policy + + +class Usage(msrest.serialization.Model): + """Describes Compute Resource Usage. + + 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 unit: Required. An enum describing the unit of usage measurement. Default value: "Count". + :vartype unit: str + :param current_value: Required. The current usage of the resource. + :type current_value: int + :param limit: Required. The maximum permitted usage of the resource. + :type limit: long + :param name: Required. The name of the type of usage. + :type name: ~azure.mgmt.compute.v2021_03_01.models.UsageName + """ + + _validation = { + 'unit': {'required': True, 'constant': True}, + 'current_value': {'required': True}, + 'limit': {'required': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'unit': {'key': 'unit', 'type': 'str'}, + 'current_value': {'key': 'currentValue', 'type': 'int'}, + 'limit': {'key': 'limit', 'type': 'long'}, + 'name': {'key': 'name', 'type': 'UsageName'}, + } + + unit = "Count" + + def __init__( + self, + *, + current_value: int, + limit: int, + name: "UsageName", + **kwargs + ): + super(Usage, self).__init__(**kwargs) + self.current_value = current_value + self.limit = limit + self.name = name + + +class UsageName(msrest.serialization.Model): + """The Usage Names. + + :param value: The name of the resource. + :type value: str + :param localized_value: The localized name of the resource. + :type localized_value: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'localized_value': {'key': 'localizedValue', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[str] = None, + localized_value: Optional[str] = None, + **kwargs + ): + super(UsageName, self).__init__(**kwargs) + self.value = value + self.localized_value = localized_value + + +class UserAssignedIdentitiesValue(msrest.serialization.Model): + """UserAssignedIdentitiesValue. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(UserAssignedIdentitiesValue, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class VaultCertificate(msrest.serialization.Model): + """Describes a single certificate reference in a Key Vault, and where the certificate should reside on the VM. + + :param certificate_url: This is the URL of a certificate that has been uploaded to Key Vault as + a secret. For adding a secret to the Key Vault, see `Add a key or secret to the key vault + `_. In this case, your + certificate needs to be It is the Base64 encoding of the following JSON Object which is encoded + in UTF-8: :code:`
    `:code:`
    ` {:code:`
    ` "data":":code:``",:code:`
    ` "dataType":"pfx",:code:`
    ` "password":":code:``":code:`
    `}. + :type certificate_url: str + :param certificate_store: For Windows VMs, specifies the certificate store on the Virtual + Machine to which the certificate should be added. The specified certificate store is implicitly + in the LocalMachine account. :code:`
    `:code:`
    `For Linux VMs, the certificate file is + placed under the /var/lib/waagent directory, with the file name <UppercaseThumbprint>.crt + for the X509 certificate file and <UppercaseThumbprint>.prv for private key. Both of + these files are .pem formatted. + :type certificate_store: str + """ + + _attribute_map = { + 'certificate_url': {'key': 'certificateUrl', 'type': 'str'}, + 'certificate_store': {'key': 'certificateStore', 'type': 'str'}, + } + + def __init__( + self, + *, + certificate_url: Optional[str] = None, + certificate_store: Optional[str] = None, + **kwargs + ): + super(VaultCertificate, self).__init__(**kwargs) + self.certificate_url = certificate_url + self.certificate_store = certificate_store + + +class VaultSecretGroup(msrest.serialization.Model): + """Describes a set of certificates which are all in the same Key Vault. + + :param source_vault: The relative URL of the Key Vault containing all of the certificates in + VaultCertificates. + :type source_vault: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param vault_certificates: The list of key vault references in SourceVault which contain + certificates. + :type vault_certificates: list[~azure.mgmt.compute.v2021_03_01.models.VaultCertificate] + """ + + _attribute_map = { + 'source_vault': {'key': 'sourceVault', 'type': 'SubResource'}, + 'vault_certificates': {'key': 'vaultCertificates', 'type': '[VaultCertificate]'}, + } + + def __init__( + self, + *, + source_vault: Optional["SubResource"] = None, + vault_certificates: Optional[List["VaultCertificate"]] = None, + **kwargs + ): + super(VaultSecretGroup, self).__init__(**kwargs) + self.source_vault = source_vault + self.vault_certificates = vault_certificates + + +class VirtualHardDisk(msrest.serialization.Model): + """Describes the uri of a disk. + + :param uri: Specifies the virtual hard disk's uri. + :type uri: str + """ + + _attribute_map = { + 'uri': {'key': 'uri', 'type': 'str'}, + } + + def __init__( + self, + *, + uri: Optional[str] = None, + **kwargs + ): + super(VirtualHardDisk, self).__init__(**kwargs) + self.uri = uri + + +class VirtualMachine(Resource): + """Describes a 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 id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param plan: Specifies information about the marketplace image used to create the virtual + machine. This element is only used for marketplace images. Before you can use a marketplace + image from an API, you must enable the image for programmatic use. In the Azure portal, find + the marketplace image that you want to use and then click **Want to deploy programmatically, + Get Started ->**. Enter any required information and then click **Save**. + :type plan: ~azure.mgmt.compute.v2021_03_01.models.Plan + :ivar resources: The virtual machine child extension resources. + :vartype resources: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtension] + :param identity: The identity of the virtual machine, if configured. + :type identity: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineIdentity + :param zones: The virtual machine zones. + :type zones: list[str] + :param extended_location: The extended location of the Virtual Machine. + :type extended_location: ~azure.mgmt.compute.v2021_03_01.models.ExtendedLocation + :param hardware_profile: Specifies the hardware settings for the virtual machine. + :type hardware_profile: ~azure.mgmt.compute.v2021_03_01.models.HardwareProfile + :param storage_profile: Specifies the storage settings for the virtual machine disks. + :type storage_profile: ~azure.mgmt.compute.v2021_03_01.models.StorageProfile + :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + virtual machine. + :type additional_capabilities: ~azure.mgmt.compute.v2021_03_01.models.AdditionalCapabilities + :param os_profile: Specifies the operating system settings used while creating the virtual + machine. Some of the settings cannot be changed once VM is provisioned. + :type os_profile: ~azure.mgmt.compute.v2021_03_01.models.OSProfile + :param network_profile: Specifies the network interfaces of the virtual machine. + :type network_profile: ~azure.mgmt.compute.v2021_03_01.models.NetworkProfile + :param security_profile: Specifies the Security related profile settings for the virtual + machine. + :type security_profile: ~azure.mgmt.compute.v2021_03_01.models.SecurityProfile + :param diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :type diagnostics_profile: ~azure.mgmt.compute.v2021_03_01.models.DiagnosticsProfile + :param availability_set: Specifies information about the availability set that the virtual + machine should be assigned to. Virtual machines specified in the same availability set are + allocated to different nodes to maximize availability. For more information about availability + sets, see `Manage the availability of virtual machines + `_. :code:`
    `:code:`
    ` + For more information on Azure planned maintenance, see `Planned maintenance for virtual + machines in Azure `_ + :code:`
    `:code:`
    ` Currently, a VM can only be added to availability set at creation + time. The availability set to which the VM is being added should be under the same resource + group as the availability set resource. An existing VM cannot be added to an availability set. + :code:`
    `:code:`
    `This property cannot exist along with a non-null + properties.virtualMachineScaleSet reference. + :type availability_set: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param virtual_machine_scale_set: Specifies information about the virtual machine scale set + that the virtual machine should be assigned to. Virtual machines specified in the same virtual + machine scale set are allocated to different nodes to maximize availability. Currently, a VM + can only be added to virtual machine scale set at creation time. An existing VM cannot be added + to a virtual machine scale set. :code:`
    `:code:`
    `This property cannot exist along with a + non-null properties.availabilitySet reference. :code:`
    `:code:`
    `Minimum api‐version: + 2019‐03‐01. + :type virtual_machine_scale_set: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param proximity_placement_group: Specifies information about the proximity placement group + that the virtual machine should be assigned to. :code:`
    `:code:`
    `Minimum api-version: + 2018-04-01. + :type proximity_placement_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param priority: Specifies the priority for the virtual machine. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. Possible values include: "Regular", + "Low", "Spot". + :type priority: str or ~azure.mgmt.compute.v2021_03_01.models.VirtualMachinePriorityTypes + :param eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and + Azure Spot scale set. :code:`
    `:code:`
    `For Azure Spot virtual machines, both + 'Deallocate' and 'Delete' are supported and the minimum api-version is 2019-03-01. + :code:`
    `:code:`
    `For Azure Spot scale sets, both 'Deallocate' and 'Delete' are supported + and the minimum api-version is 2017-10-30-preview. Possible values include: "Deallocate", + "Delete". + :type eviction_policy: str or + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineEvictionPolicyTypes + :param billing_profile: Specifies the billing related details of a Azure Spot virtual machine. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :type billing_profile: ~azure.mgmt.compute.v2021_03_01.models.BillingProfile + :param host: Specifies information about the dedicated host that the virtual machine resides + in. :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :type host: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param host_group: Specifies information about the dedicated host group that the virtual + machine resides in. :code:`
    `:code:`
    `Minimum api-version: 2020-06-01. + :code:`
    `:code:`
    `NOTE: User cannot specify both host and hostGroup properties. + :type host_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :ivar instance_view: The virtual machine instance view. + :vartype instance_view: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineInstanceView + :param license_type: Specifies that the image or disk that is being used was licensed on- + premises. :code:`
    `:code:`
    ` Possible values for Windows Server operating system are: + :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server + :code:`
    `:code:`
    ` Possible values for Linux Server operating system are: + :code:`
    `:code:`
    ` RHEL_BYOS (for RHEL) :code:`
    `:code:`
    ` SLES_BYOS (for SUSE) + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` `Azure Hybrid Use Benefit for Linux Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :type license_type: str + :ivar vm_id: Specifies the VM unique ID which is a 128-bits identifier that is encoded and + stored in all Azure IaaS VMs SMBIOS and can be read using platform BIOS commands. + :vartype vm_id: str + :param extensions_time_budget: Specifies the time alloted for all extensions to start. The time + duration should be between 15 minutes and 120 minutes (inclusive) and should be specified in + ISO 8601 format. The default value is 90 minutes (PT1H30M). :code:`
    `:code:`
    ` Minimum + api-version: 2020-06-01. + :type extensions_time_budget: str + :param platform_fault_domain: Specifies the scale set logical fault domain into which the + Virtual Machine will be created. By default, the Virtual Machine will by automatically assigned + to a fault domain that best maintains balance across available fault + domains.:code:`
    `:code:`
  • `This is applicable only if the 'virtualMachineScaleSet' + property of this Virtual Machine is set.:code:`
  • `The Virtual Machine Scale Set that is + referenced, must have 'platformFaultDomainCount' > 1.:code:`
  • `This property cannot be + updated once the Virtual Machine is created.:code:`
  • `Fault domain assignment can be viewed + in the Virtual Machine Instance View.:code:`
    `:code:`
    `Minimum api‐version: 2020‐12‐01. + :type platform_fault_domain: int + :param user_data: UserData for the VM, which must be base-64 encoded. Customer should not pass + any secrets in here. :code:`
    `:code:`
    `Minimum api-version: 2021-03-01. + :type user_data: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'resources': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'instance_view': {'readonly': True}, + 'vm_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'plan': {'key': 'plan', 'type': 'Plan'}, + 'resources': {'key': 'resources', 'type': '[VirtualMachineExtension]'}, + 'identity': {'key': 'identity', 'type': 'VirtualMachineIdentity'}, + 'zones': {'key': 'zones', 'type': '[str]'}, + 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, + 'hardware_profile': {'key': 'properties.hardwareProfile', 'type': 'HardwareProfile'}, + 'storage_profile': {'key': 'properties.storageProfile', 'type': 'StorageProfile'}, + 'additional_capabilities': {'key': 'properties.additionalCapabilities', 'type': 'AdditionalCapabilities'}, + 'os_profile': {'key': 'properties.osProfile', 'type': 'OSProfile'}, + 'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'}, + 'security_profile': {'key': 'properties.securityProfile', 'type': 'SecurityProfile'}, + 'diagnostics_profile': {'key': 'properties.diagnosticsProfile', 'type': 'DiagnosticsProfile'}, + 'availability_set': {'key': 'properties.availabilitySet', 'type': 'SubResource'}, + 'virtual_machine_scale_set': {'key': 'properties.virtualMachineScaleSet', 'type': 'SubResource'}, + 'proximity_placement_group': {'key': 'properties.proximityPlacementGroup', 'type': 'SubResource'}, + 'priority': {'key': 'properties.priority', 'type': 'str'}, + 'eviction_policy': {'key': 'properties.evictionPolicy', 'type': 'str'}, + 'billing_profile': {'key': 'properties.billingProfile', 'type': 'BillingProfile'}, + 'host': {'key': 'properties.host', 'type': 'SubResource'}, + 'host_group': {'key': 'properties.hostGroup', 'type': 'SubResource'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'instance_view': {'key': 'properties.instanceView', 'type': 'VirtualMachineInstanceView'}, + 'license_type': {'key': 'properties.licenseType', 'type': 'str'}, + 'vm_id': {'key': 'properties.vmId', 'type': 'str'}, + 'extensions_time_budget': {'key': 'properties.extensionsTimeBudget', 'type': 'str'}, + 'platform_fault_domain': {'key': 'properties.platformFaultDomain', 'type': 'int'}, + 'user_data': {'key': 'properties.userData', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + plan: Optional["Plan"] = None, + identity: Optional["VirtualMachineIdentity"] = None, + zones: Optional[List[str]] = None, + extended_location: Optional["ExtendedLocation"] = None, + hardware_profile: Optional["HardwareProfile"] = None, + storage_profile: Optional["StorageProfile"] = None, + additional_capabilities: Optional["AdditionalCapabilities"] = None, + os_profile: Optional["OSProfile"] = None, + network_profile: Optional["NetworkProfile"] = None, + security_profile: Optional["SecurityProfile"] = None, + diagnostics_profile: Optional["DiagnosticsProfile"] = None, + availability_set: Optional["SubResource"] = None, + virtual_machine_scale_set: Optional["SubResource"] = None, + proximity_placement_group: Optional["SubResource"] = None, + priority: Optional[Union[str, "VirtualMachinePriorityTypes"]] = None, + eviction_policy: Optional[Union[str, "VirtualMachineEvictionPolicyTypes"]] = None, + billing_profile: Optional["BillingProfile"] = None, + host: Optional["SubResource"] = None, + host_group: Optional["SubResource"] = None, + license_type: Optional[str] = None, + extensions_time_budget: Optional[str] = None, + platform_fault_domain: Optional[int] = None, + user_data: Optional[str] = None, + **kwargs + ): + super(VirtualMachine, self).__init__(location=location, tags=tags, **kwargs) + self.plan = plan + self.resources = None + self.identity = identity + self.zones = zones + self.extended_location = extended_location + self.hardware_profile = hardware_profile + self.storage_profile = storage_profile + self.additional_capabilities = additional_capabilities + self.os_profile = os_profile + self.network_profile = network_profile + self.security_profile = security_profile + self.diagnostics_profile = diagnostics_profile + self.availability_set = availability_set + self.virtual_machine_scale_set = virtual_machine_scale_set + self.proximity_placement_group = proximity_placement_group + self.priority = priority + self.eviction_policy = eviction_policy + self.billing_profile = billing_profile + self.host = host + self.host_group = host_group + self.provisioning_state = None + self.instance_view = None + self.license_type = license_type + self.vm_id = None + self.extensions_time_budget = extensions_time_budget + self.platform_fault_domain = platform_fault_domain + self.user_data = user_data + + +class VirtualMachineAgentInstanceView(msrest.serialization.Model): + """The instance view of the VM Agent running on the virtual machine. + + :param vm_agent_version: The VM Agent full version. + :type vm_agent_version: str + :param extension_handlers: The virtual machine extension handler instance view. + :type extension_handlers: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtensionHandlerInstanceView] + :param statuses: The resource status information. + :type statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + """ + + _attribute_map = { + 'vm_agent_version': {'key': 'vmAgentVersion', 'type': 'str'}, + 'extension_handlers': {'key': 'extensionHandlers', 'type': '[VirtualMachineExtensionHandlerInstanceView]'}, + 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, + } + + def __init__( + self, + *, + vm_agent_version: Optional[str] = None, + extension_handlers: Optional[List["VirtualMachineExtensionHandlerInstanceView"]] = None, + statuses: Optional[List["InstanceViewStatus"]] = None, + **kwargs + ): + super(VirtualMachineAgentInstanceView, self).__init__(**kwargs) + self.vm_agent_version = vm_agent_version + self.extension_handlers = extension_handlers + self.statuses = statuses + + +class VirtualMachineAssessPatchesResult(msrest.serialization.Model): + """Describes the properties of an AssessPatches result. + + 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 "Unknown", "Failed", "Succeeded", + or "CompletedWithWarnings.". Possible values include: "Unknown", "InProgress", "Failed", + "Succeeded", "CompletedWithWarnings". + :vartype status: str or ~azure.mgmt.compute.v2021_03_01.models.PatchOperationStatus + :ivar assessment_activity_id: The activity ID of the operation that produced this result. It is + used to correlate across CRP and extension logs. + :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 critical_and_security_patch_count: The number of critical or security patches that have + been detected as available and not yet installed. + :vartype critical_and_security_patch_count: int + :ivar other_patch_count: The number of all available patches excluding critical and security. + :vartype other_patch_count: int + :ivar start_date_time: The UTC timestamp when the operation began. + :vartype start_date_time: ~datetime.datetime + :ivar available_patches: The list of patches that have been detected as available for + installation. + :vartype available_patches: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineSoftwarePatchProperties] + :ivar error: The errors that were encountered during execution of the operation. The details + array contains the list of them. + :vartype error: ~azure.mgmt.compute.v2021_03_01.models.ApiError + """ + + _validation = { + 'status': {'readonly': True}, + 'assessment_activity_id': {'readonly': True}, + 'reboot_pending': {'readonly': True}, + 'critical_and_security_patch_count': {'readonly': True}, + 'other_patch_count': {'readonly': True}, + 'start_date_time': {'readonly': True}, + 'available_patches': {'readonly': True}, + 'error': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'assessment_activity_id': {'key': 'assessmentActivityId', 'type': 'str'}, + 'reboot_pending': {'key': 'rebootPending', 'type': 'bool'}, + 'critical_and_security_patch_count': {'key': 'criticalAndSecurityPatchCount', 'type': 'int'}, + 'other_patch_count': {'key': 'otherPatchCount', 'type': 'int'}, + 'start_date_time': {'key': 'startDateTime', 'type': 'iso-8601'}, + 'available_patches': {'key': 'availablePatches', 'type': '[VirtualMachineSoftwarePatchProperties]'}, + 'error': {'key': 'error', 'type': 'ApiError'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineAssessPatchesResult, self).__init__(**kwargs) + self.status = None + self.assessment_activity_id = None + self.reboot_pending = None + self.critical_and_security_patch_count = None + self.other_patch_count = None + self.start_date_time = None + self.available_patches = None + self.error = None + + +class VirtualMachineCaptureParameters(msrest.serialization.Model): + """Capture Virtual Machine parameters. + + All required parameters must be populated in order to send to Azure. + + :param vhd_prefix: Required. The captured virtual hard disk's name prefix. + :type vhd_prefix: str + :param destination_container_name: Required. The destination container name. + :type destination_container_name: str + :param overwrite_vhds: Required. Specifies whether to overwrite the destination virtual hard + disk, in case of conflict. + :type overwrite_vhds: bool + """ + + _validation = { + 'vhd_prefix': {'required': True}, + 'destination_container_name': {'required': True}, + 'overwrite_vhds': {'required': True}, + } + + _attribute_map = { + 'vhd_prefix': {'key': 'vhdPrefix', 'type': 'str'}, + 'destination_container_name': {'key': 'destinationContainerName', 'type': 'str'}, + 'overwrite_vhds': {'key': 'overwriteVhds', 'type': 'bool'}, + } + + def __init__( + self, + *, + vhd_prefix: str, + destination_container_name: str, + overwrite_vhds: bool, + **kwargs + ): + super(VirtualMachineCaptureParameters, self).__init__(**kwargs) + self.vhd_prefix = vhd_prefix + self.destination_container_name = destination_container_name + self.overwrite_vhds = overwrite_vhds + + +class VirtualMachineCaptureResult(SubResource): + """Output of virtual machine capture operation. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param id: Resource Id. + :type id: str + :ivar schema: the schema of the captured virtual machine. + :vartype schema: str + :ivar content_version: the version of the content. + :vartype content_version: str + :ivar parameters: parameters of the captured virtual machine. + :vartype parameters: object + :ivar resources: a list of resource items of the captured virtual machine. + :vartype resources: list[object] + """ + + _validation = { + 'schema': {'readonly': True}, + 'content_version': {'readonly': True}, + 'parameters': {'readonly': True}, + 'resources': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'schema': {'key': '$schema', 'type': 'str'}, + 'content_version': {'key': 'contentVersion', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': 'object'}, + 'resources': {'key': 'resources', 'type': '[object]'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + super(VirtualMachineCaptureResult, self).__init__(id=id, **kwargs) + self.schema = None + self.content_version = None + self.parameters = None + self.resources = None + + +class VirtualMachineExtension(Resource): + """Describes a Virtual Machine Extension. + + 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 id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :type force_update_tag: str + :param publisher: The name of the extension handler publisher. + :type publisher: str + :param type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :type type_properties_type: str + :param type_handler_version: Specifies the version of the script handler. + :type type_handler_version: str + :param 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. + :type auto_upgrade_minor_version: bool + :param enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :type enable_automatic_upgrade: bool + :param settings: Json formatted public settings for the extension. + :type settings: object + :param protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :type protected_settings: object + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :param instance_view: The virtual machine extension instance view. + :type instance_view: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtensionInstanceView + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', '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'}, + 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, + 'enable_automatic_upgrade': {'key': 'properties.enableAutomaticUpgrade', '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': 'VirtualMachineExtensionInstanceView'}, + } + + def __init__( + self, + *, + location: str, + 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, + auto_upgrade_minor_version: Optional[bool] = None, + enable_automatic_upgrade: Optional[bool] = None, + settings: Optional[object] = None, + protected_settings: Optional[object] = None, + instance_view: Optional["VirtualMachineExtensionInstanceView"] = None, + **kwargs + ): + super(VirtualMachineExtension, self).__init__(location=location, tags=tags, **kwargs) + 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.auto_upgrade_minor_version = auto_upgrade_minor_version + self.enable_automatic_upgrade = enable_automatic_upgrade + self.settings = settings + self.protected_settings = protected_settings + self.provisioning_state = None + self.instance_view = instance_view + + +class VirtualMachineExtensionHandlerInstanceView(msrest.serialization.Model): + """The instance view of a virtual machine extension handler. + + :param type: Specifies the type of the extension; an example is "CustomScriptExtension". + :type type: str + :param type_handler_version: Specifies the version of the script handler. + :type type_handler_version: str + :param status: The extension handler status. + :type status: ~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'type_handler_version': {'key': 'typeHandlerVersion', 'type': 'str'}, + 'status': {'key': 'status', 'type': 'InstanceViewStatus'}, + } + + def __init__( + self, + *, + type: Optional[str] = None, + type_handler_version: Optional[str] = None, + status: Optional["InstanceViewStatus"] = None, + **kwargs + ): + super(VirtualMachineExtensionHandlerInstanceView, self).__init__(**kwargs) + self.type = type + self.type_handler_version = type_handler_version + self.status = status + + +class VirtualMachineExtensionImage(Resource): + """Describes a Virtual Machine Extension Image. + + 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 id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param operating_system: The operating system this extension supports. + :type operating_system: str + :param compute_role: The type of role (IaaS or PaaS) this extension supports. + :type compute_role: str + :param handler_schema: The schema defined by publisher, where extension consumers should + provide settings in a matching schema. + :type handler_schema: str + :param vm_scale_set_enabled: Whether the extension can be used on xRP VMScaleSets. By default + existing extensions are usable on scalesets, but there might be cases where a publisher wants + to explicitly indicate the extension is only enabled for CRP VMs but not VMSS. + :type vm_scale_set_enabled: bool + :param supports_multiple_extensions: Whether the handler can support multiple extensions. + :type supports_multiple_extensions: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'operating_system': {'key': 'properties.operatingSystem', 'type': 'str'}, + 'compute_role': {'key': 'properties.computeRole', 'type': 'str'}, + 'handler_schema': {'key': 'properties.handlerSchema', 'type': 'str'}, + 'vm_scale_set_enabled': {'key': 'properties.vmScaleSetEnabled', 'type': 'bool'}, + 'supports_multiple_extensions': {'key': 'properties.supportsMultipleExtensions', 'type': 'bool'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + operating_system: Optional[str] = None, + compute_role: Optional[str] = None, + handler_schema: Optional[str] = None, + vm_scale_set_enabled: Optional[bool] = None, + supports_multiple_extensions: Optional[bool] = None, + **kwargs + ): + super(VirtualMachineExtensionImage, self).__init__(location=location, tags=tags, **kwargs) + self.operating_system = operating_system + self.compute_role = compute_role + self.handler_schema = handler_schema + self.vm_scale_set_enabled = vm_scale_set_enabled + self.supports_multiple_extensions = supports_multiple_extensions + + +class VirtualMachineExtensionInstanceView(msrest.serialization.Model): + """The instance view of a virtual machine extension. + + :param name: The virtual machine extension name. + :type name: str + :param type: Specifies the type of the extension; an example is "CustomScriptExtension". + :type type: str + :param type_handler_version: Specifies the version of the script handler. + :type type_handler_version: str + :param substatuses: The resource status information. + :type substatuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + :param statuses: The resource status information. + :type statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'type_handler_version': {'key': 'typeHandlerVersion', 'type': 'str'}, + 'substatuses': {'key': 'substatuses', 'type': '[InstanceViewStatus]'}, + 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[str] = None, + type_handler_version: Optional[str] = None, + substatuses: Optional[List["InstanceViewStatus"]] = None, + statuses: Optional[List["InstanceViewStatus"]] = None, + **kwargs + ): + super(VirtualMachineExtensionInstanceView, self).__init__(**kwargs) + self.name = name + self.type = type + self.type_handler_version = type_handler_version + self.substatuses = substatuses + self.statuses = statuses + + +class VirtualMachineExtensionsListResult(msrest.serialization.Model): + """The List Extension operation response. + + :param value: The list of extensions. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtension] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VirtualMachineExtension]'}, + } + + def __init__( + self, + *, + value: Optional[List["VirtualMachineExtension"]] = None, + **kwargs + ): + super(VirtualMachineExtensionsListResult, self).__init__(**kwargs) + self.value = value + + +class VirtualMachineExtensionUpdate(UpdateResource): + """Describes a Virtual Machine Extension. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :type force_update_tag: str + :param publisher: The name of the extension handler publisher. + :type publisher: str + :param type: Specifies the type of the extension; an example is "CustomScriptExtension". + :type type: str + :param type_handler_version: Specifies the version of the script handler. + :type type_handler_version: str + :param 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. + :type auto_upgrade_minor_version: bool + :param enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :type enable_automatic_upgrade: bool + :param settings: Json formatted public settings for the extension. + :type settings: object + :param protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :type protected_settings: object + """ + + _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'}, + 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, + 'enable_automatic_upgrade': {'key': 'properties.enableAutomaticUpgrade', '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, + auto_upgrade_minor_version: Optional[bool] = None, + enable_automatic_upgrade: Optional[bool] = None, + settings: Optional[object] = None, + protected_settings: Optional[object] = None, + **kwargs + ): + super(VirtualMachineExtensionUpdate, self).__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.auto_upgrade_minor_version = auto_upgrade_minor_version + self.enable_automatic_upgrade = enable_automatic_upgrade + self.settings = settings + self.protected_settings = protected_settings + + +class VirtualMachineHealthStatus(msrest.serialization.Model): + """The health status of the VM. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: The health status information for the VM. + :vartype status: ~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus + """ + + _validation = { + 'status': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'InstanceViewStatus'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineHealthStatus, self).__init__(**kwargs) + self.status = None + + +class VirtualMachineIdentity(msrest.serialization.Model): + """Identity for the virtual machine. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of virtual machine identity. This property will only be + provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant id associated with the virtual machine. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :param type: The type of identity used for the virtual machine. The type 'SystemAssigned, + UserAssigned' includes both an implicitly created identity and a set of user assigned + identities. The type 'None' will remove any identities from the virtual machine. Possible + values include: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". + :type type: str or ~azure.mgmt.compute.v2021_03_01.models.ResourceIdentityType + :param user_assigned_identities: The list of user identities associated with the Virtual + Machine. The user identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :type user_assigned_identities: dict[str, + ~azure.mgmt.compute.v2021_03_01.models.UserAssignedIdentitiesValue] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentitiesValue}'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "UserAssignedIdentitiesValue"]] = None, + **kwargs + ): + super(VirtualMachineIdentity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class VirtualMachineImageResource(SubResource): + """Virtual machine image resource information. + + All required parameters must be populated in order to send to Azure. + + :param id: Resource Id. + :type id: str + :param name: Required. The name of the resource. + :type name: str + :param location: Required. The supported Azure location of the resource. + :type location: str + :param tags: A set of tags. Specifies the tags that are assigned to the virtual machine. For + more information about using tags, see `Using tags to organize your Azure resources + `_. + :type tags: dict[str, str] + :param extended_location: The extended location of the Virtual Machine. + :type extended_location: ~azure.mgmt.compute.v2021_03_01.models.ExtendedLocation + """ + + _validation = { + 'name': {'required': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, + } + + def __init__( + self, + *, + name: str, + location: str, + id: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + extended_location: Optional["ExtendedLocation"] = None, + **kwargs + ): + super(VirtualMachineImageResource, self).__init__(id=id, **kwargs) + self.name = name + self.location = location + self.tags = tags + self.extended_location = extended_location + + +class VirtualMachineImage(VirtualMachineImageResource): + """Describes a Virtual Machine Image. + + All required parameters must be populated in order to send to Azure. + + :param id: Resource Id. + :type id: str + :param name: Required. The name of the resource. + :type name: str + :param location: Required. The supported Azure location of the resource. + :type location: str + :param tags: A set of tags. Specifies the tags that are assigned to the virtual machine. For + more information about using tags, see `Using tags to organize your Azure resources + `_. + :type tags: dict[str, str] + :param extended_location: The extended location of the Virtual Machine. + :type extended_location: ~azure.mgmt.compute.v2021_03_01.models.ExtendedLocation + :param plan: Used for establishing the purchase context of any 3rd Party artifact through + MarketPlace. + :type plan: ~azure.mgmt.compute.v2021_03_01.models.PurchasePlan + :param os_disk_image: Contains the os disk image information. + :type os_disk_image: ~azure.mgmt.compute.v2021_03_01.models.OSDiskImage + :param data_disk_images: + :type data_disk_images: list[~azure.mgmt.compute.v2021_03_01.models.DataDiskImage] + :param automatic_os_upgrade_properties: Describes automatic OS upgrade properties on the image. + :type automatic_os_upgrade_properties: + ~azure.mgmt.compute.v2021_03_01.models.AutomaticOSUpgradeProperties + :param hyper_v_generation: Specifies the HyperVGeneration Type. Possible values include: "V1", + "V2". + :type hyper_v_generation: str or ~azure.mgmt.compute.v2021_03_01.models.HyperVGenerationTypes + :param disallowed: Specifies disallowed configuration for the VirtualMachine created from the + image. + :type disallowed: ~azure.mgmt.compute.v2021_03_01.models.DisallowedConfiguration + :param features: + :type features: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineImageFeature] + """ + + _validation = { + 'name': {'required': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, + 'plan': {'key': 'properties.plan', 'type': 'PurchasePlan'}, + 'os_disk_image': {'key': 'properties.osDiskImage', 'type': 'OSDiskImage'}, + 'data_disk_images': {'key': 'properties.dataDiskImages', 'type': '[DataDiskImage]'}, + 'automatic_os_upgrade_properties': {'key': 'properties.automaticOSUpgradeProperties', 'type': 'AutomaticOSUpgradeProperties'}, + 'hyper_v_generation': {'key': 'properties.hyperVGeneration', 'type': 'str'}, + 'disallowed': {'key': 'properties.disallowed', 'type': 'DisallowedConfiguration'}, + 'features': {'key': 'properties.features', 'type': '[VirtualMachineImageFeature]'}, + } + + def __init__( + self, + *, + name: str, + location: str, + id: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + extended_location: Optional["ExtendedLocation"] = None, + plan: Optional["PurchasePlan"] = None, + os_disk_image: Optional["OSDiskImage"] = None, + data_disk_images: Optional[List["DataDiskImage"]] = None, + automatic_os_upgrade_properties: Optional["AutomaticOSUpgradeProperties"] = None, + hyper_v_generation: Optional[Union[str, "HyperVGenerationTypes"]] = None, + disallowed: Optional["DisallowedConfiguration"] = None, + features: Optional[List["VirtualMachineImageFeature"]] = None, + **kwargs + ): + super(VirtualMachineImage, self).__init__(id=id, name=name, location=location, tags=tags, extended_location=extended_location, **kwargs) + self.plan = plan + self.os_disk_image = os_disk_image + self.data_disk_images = data_disk_images + self.automatic_os_upgrade_properties = automatic_os_upgrade_properties + self.hyper_v_generation = hyper_v_generation + self.disallowed = disallowed + self.features = features + + +class VirtualMachineImageFeature(msrest.serialization.Model): + """Specifies additional capabilities supported by the image. + + :param name: The name of the feature. + :type name: str + :param value: The corresponding value for the feature. + :type value: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + **kwargs + ): + super(VirtualMachineImageFeature, self).__init__(**kwargs) + self.name = name + self.value = value + + +class VirtualMachineInstallPatchesParameters(msrest.serialization.Model): + """Input for InstallPatches as directly received by the API. + + All required parameters must be populated in order to send to Azure. + + :param maximum_duration: Required. 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). + :type maximum_duration: str + :param reboot_setting: Required. Defines when it is acceptable to reboot a VM during a software + update operation. Possible values include: "IfRequired", "Never", "Always". + :type reboot_setting: str or ~azure.mgmt.compute.v2021_03_01.models.VMGuestPatchRebootSetting + :param windows_parameters: Input for InstallPatches on a Windows VM, as directly received by + the API. + :type windows_parameters: ~azure.mgmt.compute.v2021_03_01.models.WindowsParameters + :param linux_parameters: Input for InstallPatches on a Linux VM, as directly received by the + API. + :type linux_parameters: ~azure.mgmt.compute.v2021_03_01.models.LinuxParameters + """ + + _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'}, + } + + def __init__( + self, + *, + maximum_duration: str, + reboot_setting: Union[str, "VMGuestPatchRebootSetting"], + windows_parameters: Optional["WindowsParameters"] = None, + linux_parameters: Optional["LinuxParameters"] = None, + **kwargs + ): + super(VirtualMachineInstallPatchesParameters, self).__init__(**kwargs) + self.maximum_duration = maximum_duration + self.reboot_setting = reboot_setting + self.windows_parameters = windows_parameters + self.linux_parameters = linux_parameters + + +class VirtualMachineInstallPatchesResult(msrest.serialization.Model): + """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.". Possible values include: "Unknown", "InProgress", "Failed", + "Succeeded", "CompletedWithWarnings". + :vartype status: str or ~azure.mgmt.compute.v2021_03_01.models.PatchOperationStatus + :ivar installation_activity_id: The activity ID of the operation that produced this result. It + is used to correlate across CRP and extension logs. + :vartype installation_activity_id: str + :ivar reboot_status: The reboot state of the VM following completion of the operation. Possible + values include: "Unknown", "NotNeeded", "Required", "Started", "Failed", "Completed". + :vartype reboot_status: str or ~azure.mgmt.compute.v2021_03_01.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 patches: The patches that were installed during the operation. + :vartype patches: list[~azure.mgmt.compute.v2021_03_01.models.PatchInstallationDetail] + :ivar start_date_time: The UTC timestamp when the operation began. + :vartype start_date_time: ~datetime.datetime + :ivar error: The errors that were encountered during execution of the operation. The details + array contains the list of them. + :vartype error: ~azure.mgmt.compute.v2021_03_01.models.ApiError + """ + + _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}, + 'patches': {'readonly': True}, + 'start_date_time': {'readonly': True}, + 'error': {'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'}, + 'patches': {'key': 'patches', 'type': '[PatchInstallationDetail]'}, + 'start_date_time': {'key': 'startDateTime', 'type': 'iso-8601'}, + 'error': {'key': 'error', 'type': 'ApiError'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineInstallPatchesResult, self).__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.patches = None + self.start_date_time = None + self.error = None + + +class VirtualMachineInstanceView(msrest.serialization.Model): + """The instance view of a virtual machine. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param platform_update_domain: Specifies the update domain of the virtual machine. + :type platform_update_domain: int + :param platform_fault_domain: Specifies the fault domain of the virtual machine. + :type platform_fault_domain: int + :param computer_name: The computer name assigned to the virtual machine. + :type computer_name: str + :param os_name: The Operating System running on the virtual machine. + :type os_name: str + :param os_version: The version of Operating System running on the virtual machine. + :type os_version: str + :param hyper_v_generation: Specifies the HyperVGeneration Type associated with a resource. + Possible values include: "V1", "V2". + :type hyper_v_generation: str or ~azure.mgmt.compute.v2021_03_01.models.HyperVGenerationType + :param rdp_thumb_print: The Remote desktop certificate thumbprint. + :type rdp_thumb_print: str + :param vm_agent: The VM Agent running on the virtual machine. + :type vm_agent: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineAgentInstanceView + :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :type maintenance_redeploy_status: + ~azure.mgmt.compute.v2021_03_01.models.MaintenanceRedeployStatus + :param disks: The virtual machine disk information. + :type disks: list[~azure.mgmt.compute.v2021_03_01.models.DiskInstanceView] + :param extensions: The extensions information. + :type extensions: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtensionInstanceView] + :ivar vm_health: The health status for the VM. + :vartype vm_health: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineHealthStatus + :param boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + Console Output and Screenshot to diagnose VM status. :code:`
    `:code:`
    ` You can easily + view the output of your console log. :code:`
    `:code:`
    ` Azure also enables you to see a + screenshot of the VM from the hypervisor. + :type boot_diagnostics: ~azure.mgmt.compute.v2021_03_01.models.BootDiagnosticsInstanceView + :ivar assigned_host: Resource id of the dedicated host, on which the virtual machine is + allocated through automatic placement, when the virtual machine is associated with a dedicated + host group that has automatic placement enabled. :code:`
    `:code:`
    `Minimum api-version: + 2020-06-01. + :vartype assigned_host: str + :param statuses: The resource status information. + :type statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + :param patch_status: [Preview Feature] The status of virtual machine patch operations. + :type patch_status: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachinePatchStatus + """ + + _validation = { + 'vm_health': {'readonly': True}, + 'assigned_host': {'readonly': True}, + } + + _attribute_map = { + 'platform_update_domain': {'key': 'platformUpdateDomain', 'type': 'int'}, + 'platform_fault_domain': {'key': 'platformFaultDomain', 'type': 'int'}, + 'computer_name': {'key': 'computerName', 'type': 'str'}, + 'os_name': {'key': 'osName', 'type': 'str'}, + 'os_version': {'key': 'osVersion', 'type': 'str'}, + 'hyper_v_generation': {'key': 'hyperVGeneration', 'type': 'str'}, + 'rdp_thumb_print': {'key': 'rdpThumbPrint', 'type': 'str'}, + 'vm_agent': {'key': 'vmAgent', 'type': 'VirtualMachineAgentInstanceView'}, + 'maintenance_redeploy_status': {'key': 'maintenanceRedeployStatus', 'type': 'MaintenanceRedeployStatus'}, + 'disks': {'key': 'disks', 'type': '[DiskInstanceView]'}, + 'extensions': {'key': 'extensions', 'type': '[VirtualMachineExtensionInstanceView]'}, + 'vm_health': {'key': 'vmHealth', 'type': 'VirtualMachineHealthStatus'}, + 'boot_diagnostics': {'key': 'bootDiagnostics', 'type': 'BootDiagnosticsInstanceView'}, + 'assigned_host': {'key': 'assignedHost', 'type': 'str'}, + 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, + 'patch_status': {'key': 'patchStatus', 'type': 'VirtualMachinePatchStatus'}, + } + + def __init__( + self, + *, + platform_update_domain: Optional[int] = None, + platform_fault_domain: Optional[int] = None, + computer_name: Optional[str] = None, + os_name: Optional[str] = None, + os_version: Optional[str] = None, + hyper_v_generation: Optional[Union[str, "HyperVGenerationType"]] = None, + rdp_thumb_print: Optional[str] = None, + vm_agent: Optional["VirtualMachineAgentInstanceView"] = None, + maintenance_redeploy_status: Optional["MaintenanceRedeployStatus"] = None, + disks: Optional[List["DiskInstanceView"]] = None, + extensions: Optional[List["VirtualMachineExtensionInstanceView"]] = None, + boot_diagnostics: Optional["BootDiagnosticsInstanceView"] = None, + statuses: Optional[List["InstanceViewStatus"]] = None, + patch_status: Optional["VirtualMachinePatchStatus"] = None, + **kwargs + ): + super(VirtualMachineInstanceView, self).__init__(**kwargs) + self.platform_update_domain = platform_update_domain + self.platform_fault_domain = platform_fault_domain + self.computer_name = computer_name + self.os_name = os_name + self.os_version = os_version + self.hyper_v_generation = hyper_v_generation + self.rdp_thumb_print = rdp_thumb_print + self.vm_agent = vm_agent + self.maintenance_redeploy_status = maintenance_redeploy_status + self.disks = disks + self.extensions = extensions + self.vm_health = None + self.boot_diagnostics = boot_diagnostics + self.assigned_host = None + self.statuses = statuses + self.patch_status = patch_status + + +class VirtualMachineListResult(msrest.serialization.Model): + """The List Virtual Machine operation response. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. The list of virtual machines. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachine] + :param next_link: The URI to fetch the next page of VMs. Call ListNext() with this URI to fetch + the next page of Virtual Machines. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VirtualMachine]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["VirtualMachine"], + next_link: Optional[str] = None, + **kwargs + ): + super(VirtualMachineListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class VirtualMachinePatchStatus(msrest.serialization.Model): + """The status of virtual machine patch operations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param available_patch_summary: The available patch summary of the latest assessment operation + for the virtual machine. + :type available_patch_summary: ~azure.mgmt.compute.v2021_03_01.models.AvailablePatchSummary + :param last_patch_installation_summary: The installation summary of the latest installation + operation for the virtual machine. + :type last_patch_installation_summary: + ~azure.mgmt.compute.v2021_03_01.models.LastPatchInstallationSummary + :ivar configuration_statuses: The enablement status of the specified patchMode. + :vartype configuration_statuses: + list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + """ + + _validation = { + 'configuration_statuses': {'readonly': True}, + } + + _attribute_map = { + 'available_patch_summary': {'key': 'availablePatchSummary', 'type': 'AvailablePatchSummary'}, + 'last_patch_installation_summary': {'key': 'lastPatchInstallationSummary', 'type': 'LastPatchInstallationSummary'}, + 'configuration_statuses': {'key': 'configurationStatuses', 'type': '[InstanceViewStatus]'}, + } + + def __init__( + self, + *, + available_patch_summary: Optional["AvailablePatchSummary"] = None, + last_patch_installation_summary: Optional["LastPatchInstallationSummary"] = None, + **kwargs + ): + super(VirtualMachinePatchStatus, self).__init__(**kwargs) + self.available_patch_summary = available_patch_summary + self.last_patch_installation_summary = last_patch_installation_summary + self.configuration_statuses = None + + +class VirtualMachineReimageParameters(msrest.serialization.Model): + """Parameters for Reimaging Virtual Machine. NOTE: Virtual Machine OS disk will always be reimaged. + + :param temp_disk: Specifies whether to reimage temp disk. Default value: false. Note: This temp + disk reimage parameter is only supported for VM/VMSS with Ephemeral OS disk. + :type temp_disk: bool + """ + + _attribute_map = { + 'temp_disk': {'key': 'tempDisk', 'type': 'bool'}, + } + + def __init__( + self, + *, + temp_disk: Optional[bool] = None, + **kwargs + ): + super(VirtualMachineReimageParameters, self).__init__(**kwargs) + self.temp_disk = temp_disk + + +class VirtualMachineRunCommand(Resource): + """Describes a Virtual Machine run command. + + 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 id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param source: The source of the run command script. + :type source: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommandScriptSource + :param parameters: The parameters used by the script. + :type parameters: list[~azure.mgmt.compute.v2021_03_01.models.RunCommandInputParameter] + :param protected_parameters: The parameters used by the script. + :type protected_parameters: + list[~azure.mgmt.compute.v2021_03_01.models.RunCommandInputParameter] + :param async_execution: Optional. If set to true, provisioning will complete as soon as the + script starts and will not wait for script to complete. + :type async_execution: bool + :param run_as_user: Specifies the user account on the VM when executing the run command. + :type run_as_user: str + :param run_as_password: Specifies the user account password on the VM when executing the run + command. + :type run_as_password: str + :param timeout_in_seconds: The timeout in seconds to execute the run command. + :type timeout_in_seconds: int + :param output_blob_uri: Specifies the Azure storage blob where script output stream will be + uploaded. + :type output_blob_uri: str + :param error_blob_uri: Specifies the Azure storage blob where script error stream will be + uploaded. + :type error_blob_uri: str + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :ivar instance_view: The virtual machine run command instance view. + :vartype instance_view: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommandInstanceView + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'instance_view': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'source': {'key': 'properties.source', 'type': 'VirtualMachineRunCommandScriptSource'}, + 'parameters': {'key': 'properties.parameters', 'type': '[RunCommandInputParameter]'}, + 'protected_parameters': {'key': 'properties.protectedParameters', 'type': '[RunCommandInputParameter]'}, + 'async_execution': {'key': 'properties.asyncExecution', 'type': 'bool'}, + 'run_as_user': {'key': 'properties.runAsUser', 'type': 'str'}, + 'run_as_password': {'key': 'properties.runAsPassword', 'type': 'str'}, + 'timeout_in_seconds': {'key': 'properties.timeoutInSeconds', 'type': 'int'}, + 'output_blob_uri': {'key': 'properties.outputBlobUri', 'type': 'str'}, + 'error_blob_uri': {'key': 'properties.errorBlobUri', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'instance_view': {'key': 'properties.instanceView', 'type': 'VirtualMachineRunCommandInstanceView'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + source: Optional["VirtualMachineRunCommandScriptSource"] = None, + parameters: Optional[List["RunCommandInputParameter"]] = None, + protected_parameters: Optional[List["RunCommandInputParameter"]] = None, + async_execution: Optional[bool] = False, + run_as_user: Optional[str] = None, + run_as_password: Optional[str] = None, + timeout_in_seconds: Optional[int] = None, + output_blob_uri: Optional[str] = None, + error_blob_uri: Optional[str] = None, + **kwargs + ): + super(VirtualMachineRunCommand, self).__init__(location=location, tags=tags, **kwargs) + self.source = source + self.parameters = parameters + self.protected_parameters = protected_parameters + self.async_execution = async_execution + self.run_as_user = run_as_user + self.run_as_password = run_as_password + self.timeout_in_seconds = timeout_in_seconds + self.output_blob_uri = output_blob_uri + self.error_blob_uri = error_blob_uri + self.provisioning_state = None + self.instance_view = None + + +class VirtualMachineRunCommandInstanceView(msrest.serialization.Model): + """The instance view of a virtual machine run command. + + :param execution_state: Script execution status. Possible values include: "Unknown", "Pending", + "Running", "Failed", "Succeeded", "TimedOut", "Canceled". + :type execution_state: str or ~azure.mgmt.compute.v2021_03_01.models.ExecutionState + :param execution_message: Communicate script configuration errors or execution messages. + :type execution_message: str + :param exit_code: Exit code returned from script execution. + :type exit_code: int + :param output: Script output stream. + :type output: str + :param error: Script error stream. + :type error: str + :param start_time: Script start time. + :type start_time: ~datetime.datetime + :param end_time: Script end time. + :type end_time: ~datetime.datetime + :param statuses: The resource status information. + :type statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + """ + + _attribute_map = { + 'execution_state': {'key': 'executionState', 'type': 'str'}, + 'execution_message': {'key': 'executionMessage', 'type': 'str'}, + 'exit_code': {'key': 'exitCode', 'type': 'int'}, + 'output': {'key': 'output', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, + } + + def __init__( + self, + *, + execution_state: Optional[Union[str, "ExecutionState"]] = None, + execution_message: Optional[str] = None, + exit_code: Optional[int] = None, + output: Optional[str] = None, + error: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + statuses: Optional[List["InstanceViewStatus"]] = None, + **kwargs + ): + super(VirtualMachineRunCommandInstanceView, self).__init__(**kwargs) + self.execution_state = execution_state + self.execution_message = execution_message + self.exit_code = exit_code + self.output = output + self.error = error + self.start_time = start_time + self.end_time = end_time + self.statuses = statuses + + +class VirtualMachineRunCommandScriptSource(msrest.serialization.Model): + """Describes the script sources for run command. + + :param script: Specifies the script content to be executed on the VM. + :type script: str + :param script_uri: Specifies the script download location. + :type script_uri: str + :param command_id: Specifies a commandId of predefined built-in script. + :type command_id: str + """ + + _attribute_map = { + 'script': {'key': 'script', 'type': 'str'}, + 'script_uri': {'key': 'scriptUri', 'type': 'str'}, + 'command_id': {'key': 'commandId', 'type': 'str'}, + } + + def __init__( + self, + *, + script: Optional[str] = None, + script_uri: Optional[str] = None, + command_id: Optional[str] = None, + **kwargs + ): + super(VirtualMachineRunCommandScriptSource, self).__init__(**kwargs) + self.script = script + self.script_uri = script_uri + self.command_id = command_id + + +class VirtualMachineRunCommandsListResult(msrest.serialization.Model): + """The List run command operation response. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. The list of run commands. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommand] + :param next_link: The uri to fetch the next page of run commands. + :type next_link: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VirtualMachineRunCommand]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["VirtualMachineRunCommand"], + next_link: Optional[str] = None, + **kwargs + ): + super(VirtualMachineRunCommandsListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class VirtualMachineRunCommandUpdate(UpdateResource): + """Describes a Virtual Machine run command. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param source: The source of the run command script. + :type source: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommandScriptSource + :param parameters: The parameters used by the script. + :type parameters: list[~azure.mgmt.compute.v2021_03_01.models.RunCommandInputParameter] + :param protected_parameters: The parameters used by the script. + :type protected_parameters: + list[~azure.mgmt.compute.v2021_03_01.models.RunCommandInputParameter] + :param async_execution: Optional. If set to true, provisioning will complete as soon as the + script starts and will not wait for script to complete. + :type async_execution: bool + :param run_as_user: Specifies the user account on the VM when executing the run command. + :type run_as_user: str + :param run_as_password: Specifies the user account password on the VM when executing the run + command. + :type run_as_password: str + :param timeout_in_seconds: The timeout in seconds to execute the run command. + :type timeout_in_seconds: int + :param output_blob_uri: Specifies the Azure storage blob where script output stream will be + uploaded. + :type output_blob_uri: str + :param error_blob_uri: Specifies the Azure storage blob where script error stream will be + uploaded. + :type error_blob_uri: str + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :ivar instance_view: The virtual machine run command instance view. + :vartype instance_view: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommandInstanceView + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'instance_view': {'readonly': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'source': {'key': 'properties.source', 'type': 'VirtualMachineRunCommandScriptSource'}, + 'parameters': {'key': 'properties.parameters', 'type': '[RunCommandInputParameter]'}, + 'protected_parameters': {'key': 'properties.protectedParameters', 'type': '[RunCommandInputParameter]'}, + 'async_execution': {'key': 'properties.asyncExecution', 'type': 'bool'}, + 'run_as_user': {'key': 'properties.runAsUser', 'type': 'str'}, + 'run_as_password': {'key': 'properties.runAsPassword', 'type': 'str'}, + 'timeout_in_seconds': {'key': 'properties.timeoutInSeconds', 'type': 'int'}, + 'output_blob_uri': {'key': 'properties.outputBlobUri', 'type': 'str'}, + 'error_blob_uri': {'key': 'properties.errorBlobUri', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'instance_view': {'key': 'properties.instanceView', 'type': 'VirtualMachineRunCommandInstanceView'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + source: Optional["VirtualMachineRunCommandScriptSource"] = None, + parameters: Optional[List["RunCommandInputParameter"]] = None, + protected_parameters: Optional[List["RunCommandInputParameter"]] = None, + async_execution: Optional[bool] = False, + run_as_user: Optional[str] = None, + run_as_password: Optional[str] = None, + timeout_in_seconds: Optional[int] = None, + output_blob_uri: Optional[str] = None, + error_blob_uri: Optional[str] = None, + **kwargs + ): + super(VirtualMachineRunCommandUpdate, self).__init__(tags=tags, **kwargs) + self.source = source + self.parameters = parameters + self.protected_parameters = protected_parameters + self.async_execution = async_execution + self.run_as_user = run_as_user + self.run_as_password = run_as_password + self.timeout_in_seconds = timeout_in_seconds + self.output_blob_uri = output_blob_uri + self.error_blob_uri = error_blob_uri + self.provisioning_state = None + self.instance_view = None + + +class VirtualMachineScaleSet(Resource): + """Describes a Virtual Machine Scale Set. + + 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 id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: The virtual machine scale set sku. + :type sku: ~azure.mgmt.compute.v2021_03_01.models.Sku + :param plan: Specifies information about the marketplace image used to create the virtual + machine. This element is only used for marketplace images. Before you can use a marketplace + image from an API, you must enable the image for programmatic use. In the Azure portal, find + the marketplace image that you want to use and then click **Want to deploy programmatically, + Get Started ->**. Enter any required information and then click **Save**. + :type plan: ~azure.mgmt.compute.v2021_03_01.models.Plan + :param identity: The identity of the virtual machine scale set, if configured. + :type identity: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetIdentity + :param zones: The virtual machine scale set zones. NOTE: Availability zones can only be set + when you create the scale set. + :type zones: list[str] + :param extended_location: The extended location of the Virtual Machine Scale Set. + :type extended_location: ~azure.mgmt.compute.v2021_03_01.models.ExtendedLocation + :param upgrade_policy: The upgrade policy. + :type upgrade_policy: ~azure.mgmt.compute.v2021_03_01.models.UpgradePolicy + :param automatic_repairs_policy: Policy for automatic repairs. + :type automatic_repairs_policy: ~azure.mgmt.compute.v2021_03_01.models.AutomaticRepairsPolicy + :param virtual_machine_profile: The virtual machine profile. + :type virtual_machine_profile: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMProfile + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :param overprovision: Specifies whether the Virtual Machine Scale Set should be + overprovisioned. + :type overprovision: bool + :param do_not_run_extensions_on_overprovisioned_v_ms: When Overprovision is enabled, extensions + are launched only on the requested number of VMs which are finally kept. This property will + hence ensure that the extensions do not run on the extra overprovisioned VMs. + :type do_not_run_extensions_on_overprovisioned_v_ms: bool + :ivar unique_id: Specifies the ID which uniquely identifies a Virtual Machine Scale Set. + :vartype unique_id: str + :param single_placement_group: When true this limits the scale set to a single placement group, + of max size 100 virtual machines. NOTE: If singlePlacementGroup is true, it may be modified to + false. However, if singlePlacementGroup is false, it may not be modified to true. + :type single_placement_group: bool + :param zone_balance: Whether to force strictly even Virtual Machine distribution cross x-zones + in case there is zone outage. + :type zone_balance: bool + :param platform_fault_domain_count: Fault Domain count for each placement group. + :type platform_fault_domain_count: int + :param proximity_placement_group: Specifies information about the proximity placement group + that the virtual machine scale set should be assigned to. :code:`
    `:code:`
    `Minimum api- + version: 2018-04-01. + :type proximity_placement_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param host_group: Specifies information about the dedicated host group that the virtual + machine scale set resides in. :code:`
    `:code:`
    `Minimum api-version: 2020-06-01. + :type host_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + Virtual Machines in the Virtual Machine Scale Set. For instance: whether the Virtual Machines + have the capability to support attaching managed data disks with UltraSSD_LRS storage account + type. + :type additional_capabilities: ~azure.mgmt.compute.v2021_03_01.models.AdditionalCapabilities + :param scale_in_policy: Specifies the scale-in policy that decides which virtual machines are + chosen for removal when a Virtual Machine Scale Set is scaled-in. + :type scale_in_policy: ~azure.mgmt.compute.v2021_03_01.models.ScaleInPolicy + :param orchestration_mode: Specifies the orchestration mode for the virtual machine scale set. + Possible values include: "Uniform", "Flexible". + :type orchestration_mode: str or ~azure.mgmt.compute.v2021_03_01.models.OrchestrationMode + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'unique_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'plan': {'key': 'plan', 'type': 'Plan'}, + 'identity': {'key': 'identity', 'type': 'VirtualMachineScaleSetIdentity'}, + 'zones': {'key': 'zones', 'type': '[str]'}, + 'extended_location': {'key': 'extendedLocation', 'type': 'ExtendedLocation'}, + 'upgrade_policy': {'key': 'properties.upgradePolicy', 'type': 'UpgradePolicy'}, + 'automatic_repairs_policy': {'key': 'properties.automaticRepairsPolicy', 'type': 'AutomaticRepairsPolicy'}, + 'virtual_machine_profile': {'key': 'properties.virtualMachineProfile', 'type': 'VirtualMachineScaleSetVMProfile'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'overprovision': {'key': 'properties.overprovision', 'type': 'bool'}, + 'do_not_run_extensions_on_overprovisioned_v_ms': {'key': 'properties.doNotRunExtensionsOnOverprovisionedVMs', 'type': 'bool'}, + 'unique_id': {'key': 'properties.uniqueId', 'type': 'str'}, + 'single_placement_group': {'key': 'properties.singlePlacementGroup', 'type': 'bool'}, + 'zone_balance': {'key': 'properties.zoneBalance', 'type': 'bool'}, + 'platform_fault_domain_count': {'key': 'properties.platformFaultDomainCount', 'type': 'int'}, + 'proximity_placement_group': {'key': 'properties.proximityPlacementGroup', 'type': 'SubResource'}, + 'host_group': {'key': 'properties.hostGroup', 'type': 'SubResource'}, + 'additional_capabilities': {'key': 'properties.additionalCapabilities', 'type': 'AdditionalCapabilities'}, + 'scale_in_policy': {'key': 'properties.scaleInPolicy', 'type': 'ScaleInPolicy'}, + 'orchestration_mode': {'key': 'properties.orchestrationMode', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + sku: Optional["Sku"] = None, + plan: Optional["Plan"] = None, + identity: Optional["VirtualMachineScaleSetIdentity"] = None, + zones: Optional[List[str]] = None, + extended_location: Optional["ExtendedLocation"] = None, + upgrade_policy: Optional["UpgradePolicy"] = None, + automatic_repairs_policy: Optional["AutomaticRepairsPolicy"] = None, + virtual_machine_profile: Optional["VirtualMachineScaleSetVMProfile"] = None, + overprovision: Optional[bool] = None, + do_not_run_extensions_on_overprovisioned_v_ms: Optional[bool] = None, + single_placement_group: Optional[bool] = None, + zone_balance: Optional[bool] = None, + platform_fault_domain_count: Optional[int] = None, + proximity_placement_group: Optional["SubResource"] = None, + host_group: Optional["SubResource"] = None, + additional_capabilities: Optional["AdditionalCapabilities"] = None, + scale_in_policy: Optional["ScaleInPolicy"] = None, + orchestration_mode: Optional[Union[str, "OrchestrationMode"]] = None, + **kwargs + ): + super(VirtualMachineScaleSet, self).__init__(location=location, tags=tags, **kwargs) + self.sku = sku + self.plan = plan + self.identity = identity + self.zones = zones + self.extended_location = extended_location + self.upgrade_policy = upgrade_policy + self.automatic_repairs_policy = automatic_repairs_policy + self.virtual_machine_profile = virtual_machine_profile + self.provisioning_state = None + self.overprovision = overprovision + self.do_not_run_extensions_on_overprovisioned_v_ms = do_not_run_extensions_on_overprovisioned_v_ms + self.unique_id = None + self.single_placement_group = single_placement_group + self.zone_balance = zone_balance + self.platform_fault_domain_count = platform_fault_domain_count + self.proximity_placement_group = proximity_placement_group + self.host_group = host_group + self.additional_capabilities = additional_capabilities + self.scale_in_policy = scale_in_policy + self.orchestration_mode = orchestration_mode - :param value: Required. - :type value: list[~azure.mgmt.compute.v2021_03_01.models.CloudService] - :param next_link: + +class VirtualMachineScaleSetDataDisk(msrest.serialization.Model): + """Describes a virtual machine scale set data disk. + + All required parameters must be populated in order to send to Azure. + + :param name: The disk name. + :type name: str + :param lun: Required. Specifies the logical unit number of the data disk. This value is used to + identify data disks within the VM and therefore must be unique for each data disk attached to a + VM. + :type lun: int + :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + are: :code:`
    `:code:`
    ` **None** :code:`
    `:code:`
    ` **ReadOnly** + :code:`
    `:code:`
    ` **ReadWrite** :code:`
    `:code:`
    ` Default: **None for Standard + storage. ReadOnly for Premium storage**. Possible values include: "None", "ReadOnly", + "ReadWrite". + :type caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes + :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :type write_accelerator_enabled: bool + :param create_option: Required. The create option. Possible values include: "FromImage", + "Empty", "Attach". + :type create_option: str or ~azure.mgmt.compute.v2021_03_01.models.DiskCreateOptionTypes + :param disk_size_gb: Specifies the size of an empty data disk in gigabytes. This element can be + used to overwrite the size of the disk in a virtual machine image. :code:`
    `:code:`
    ` + This value cannot be larger than 1023 GB. + :type disk_size_gb: int + :param managed_disk: The managed disk parameters. + :type managed_disk: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetManagedDiskParameters + :param disk_iops_read_write: Specifies the Read-Write IOPS for the managed disk. Should be used + only when StorageAccountType is UltraSSD_LRS. If not specified, a default value would be + assigned based on diskSizeGB. + :type disk_iops_read_write: long + :param disk_m_bps_read_write: Specifies the bandwidth in MB per second for the managed disk. + Should be used only when StorageAccountType is UltraSSD_LRS. If not specified, a default value + would be assigned based on diskSizeGB. + :type disk_m_bps_read_write: long + """ + + _validation = { + 'lun': {'required': True}, + 'create_option': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'lun': {'key': 'lun', 'type': 'int'}, + 'caching': {'key': 'caching', 'type': 'str'}, + 'write_accelerator_enabled': {'key': 'writeAcceleratorEnabled', 'type': 'bool'}, + 'create_option': {'key': 'createOption', 'type': 'str'}, + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, + 'managed_disk': {'key': 'managedDisk', 'type': 'VirtualMachineScaleSetManagedDiskParameters'}, + 'disk_iops_read_write': {'key': 'diskIOPSReadWrite', 'type': 'long'}, + 'disk_m_bps_read_write': {'key': 'diskMBpsReadWrite', 'type': 'long'}, + } + + def __init__( + self, + *, + lun: int, + create_option: Union[str, "DiskCreateOptionTypes"], + name: Optional[str] = None, + caching: Optional[Union[str, "CachingTypes"]] = None, + write_accelerator_enabled: Optional[bool] = None, + disk_size_gb: Optional[int] = None, + managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, + disk_iops_read_write: Optional[int] = None, + disk_m_bps_read_write: Optional[int] = None, + **kwargs + ): + super(VirtualMachineScaleSetDataDisk, self).__init__(**kwargs) + self.name = name + self.lun = lun + self.caching = caching + self.write_accelerator_enabled = write_accelerator_enabled + self.create_option = create_option + self.disk_size_gb = disk_size_gb + self.managed_disk = managed_disk + self.disk_iops_read_write = disk_iops_read_write + self.disk_m_bps_read_write = disk_m_bps_read_write + + +class VirtualMachineScaleSetExtension(SubResourceReadOnly): + """Describes a Virtual Machine Scale Set Extension. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :param name: The name of the extension. + :type name: str + :ivar type: Resource type. + :vartype type: str + :param force_update_tag: If a value is provided and is different from the previous value, the + extension handler will be forced to update even if the extension configuration has not changed. + :type force_update_tag: str + :param publisher: The name of the extension handler publisher. + :type publisher: str + :param type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :type type_properties_type: str + :param type_handler_version: Specifies the version of the script handler. + :type type_handler_version: str + :param 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. + :type auto_upgrade_minor_version: bool + :param enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :type enable_automatic_upgrade: bool + :param settings: Json formatted public settings for the extension. + :type settings: object + :param protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :type protected_settings: object + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :param provision_after_extensions: Collection of extension names after which this extension + needs to be provisioned. + :type provision_after_extensions: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', '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'}, + 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, + 'enable_automatic_upgrade': {'key': 'properties.enableAutomaticUpgrade', 'type': 'bool'}, + 'settings': {'key': 'properties.settings', 'type': 'object'}, + 'protected_settings': {'key': 'properties.protectedSettings', 'type': 'object'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'provision_after_extensions': {'key': 'properties.provisionAfterExtensions', 'type': '[str]'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + force_update_tag: Optional[str] = None, + publisher: Optional[str] = None, + type_properties_type: Optional[str] = None, + type_handler_version: Optional[str] = None, + auto_upgrade_minor_version: Optional[bool] = None, + enable_automatic_upgrade: Optional[bool] = None, + settings: Optional[object] = None, + protected_settings: Optional[object] = None, + provision_after_extensions: Optional[List[str]] = None, + **kwargs + ): + super(VirtualMachineScaleSetExtension, self).__init__(**kwargs) + self.name = name + 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.auto_upgrade_minor_version = auto_upgrade_minor_version + self.enable_automatic_upgrade = enable_automatic_upgrade + self.settings = settings + self.protected_settings = protected_settings + self.provisioning_state = None + self.provision_after_extensions = provision_after_extensions + + +class VirtualMachineScaleSetExtensionListResult(msrest.serialization.Model): + """The List VM scale set extension operation response. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. The list of VM scale set extensions. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetExtension] + :param next_link: The uri to fetch the next page of VM scale set extensions. Call ListNext() + with this to fetch the next page of VM scale set extensions. :type next_link: str """ @@ -310,235 +8449,512 @@ class CloudServiceListResult(msrest.serialization.Model): } _attribute_map = { - 'value': {'key': 'value', 'type': '[CloudService]'}, + 'value': {'key': 'value', 'type': '[VirtualMachineScaleSetExtension]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, *, - value: List["CloudService"], + value: List["VirtualMachineScaleSetExtension"], next_link: Optional[str] = None, **kwargs ): - super(CloudServiceListResult, self).__init__(**kwargs) + super(VirtualMachineScaleSetExtensionListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link -class CloudServiceNetworkProfile(msrest.serialization.Model): - """Network Profile for the cloud service. +class VirtualMachineScaleSetExtensionProfile(msrest.serialization.Model): + """Describes a virtual machine scale set extension profile. - :param load_balancer_configurations: List of Load balancer configurations. Cloud service can - have up to two load balancer configurations, corresponding to a Public Load Balancer and an - Internal Load Balancer. - :type load_balancer_configurations: - list[~azure.mgmt.compute.v2021_03_01.models.LoadBalancerConfiguration] - :param swappable_cloud_service: The id reference of the cloud service containing the target IP - with which the subject cloud service can perform a swap. This property cannot be updated once - it is set. The swappable cloud service referred by this id must be present otherwise an error - will be thrown. - :type swappable_cloud_service: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param extensions: The virtual machine scale set child extension resources. + :type extensions: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetExtension] + :param extensions_time_budget: Specifies the time alloted for all extensions to start. The time + duration should be between 15 minutes and 120 minutes (inclusive) and should be specified in + ISO 8601 format. The default value is 90 minutes (PT1H30M). :code:`
    `:code:`
    ` Minimum + api-version: 2020-06-01. + :type extensions_time_budget: str + """ + + _attribute_map = { + 'extensions': {'key': 'extensions', 'type': '[VirtualMachineScaleSetExtension]'}, + 'extensions_time_budget': {'key': 'extensionsTimeBudget', 'type': 'str'}, + } + + def __init__( + self, + *, + extensions: Optional[List["VirtualMachineScaleSetExtension"]] = None, + extensions_time_budget: Optional[str] = None, + **kwargs + ): + super(VirtualMachineScaleSetExtensionProfile, self).__init__(**kwargs) + self.extensions = extensions + self.extensions_time_budget = extensions_time_budget + + +class VirtualMachineScaleSetExtensionUpdate(SubResourceReadOnly): + """Describes a Virtual Machine Scale Set Extension. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: The name of the extension. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param force_update_tag: If a value is provided and is different from the previous value, the + extension handler will be forced to update even if the extension configuration has not changed. + :type force_update_tag: str + :param publisher: The name of the extension handler publisher. + :type publisher: str + :param type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :type type_properties_type: str + :param type_handler_version: Specifies the version of the script handler. + :type type_handler_version: str + :param 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. + :type auto_upgrade_minor_version: bool + :param enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :type enable_automatic_upgrade: bool + :param settings: Json formatted public settings for the extension. + :type settings: object + :param protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :type protected_settings: object + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :param provision_after_extensions: Collection of extension names after which this extension + needs to be provisioned. + :type provision_after_extensions: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', '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'}, + 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, + 'enable_automatic_upgrade': {'key': 'properties.enableAutomaticUpgrade', 'type': 'bool'}, + 'settings': {'key': 'properties.settings', 'type': 'object'}, + 'protected_settings': {'key': 'properties.protectedSettings', 'type': 'object'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'provision_after_extensions': {'key': 'properties.provisionAfterExtensions', 'type': '[str]'}, + } + + def __init__( + self, + *, + force_update_tag: Optional[str] = None, + publisher: Optional[str] = None, + type_properties_type: Optional[str] = None, + type_handler_version: Optional[str] = None, + auto_upgrade_minor_version: Optional[bool] = None, + enable_automatic_upgrade: Optional[bool] = None, + settings: Optional[object] = None, + protected_settings: Optional[object] = None, + provision_after_extensions: Optional[List[str]] = None, + **kwargs + ): + super(VirtualMachineScaleSetExtensionUpdate, self).__init__(**kwargs) + self.name = 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.auto_upgrade_minor_version = auto_upgrade_minor_version + self.enable_automatic_upgrade = enable_automatic_upgrade + self.settings = settings + self.protected_settings = protected_settings + self.provisioning_state = None + self.provision_after_extensions = provision_after_extensions + + +class VirtualMachineScaleSetIdentity(msrest.serialization.Model): + """Identity for the virtual machine scale set. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of virtual machine scale set identity. This property will + only be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant id associated with the virtual machine scale set. This property + will only be provided for a system assigned identity. + :vartype tenant_id: str + :param type: The type of identity used for the virtual machine scale set. The type + 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user + assigned identities. The type 'None' will remove any identities from the virtual machine scale + set. Possible values include: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", + "None". + :type type: str or ~azure.mgmt.compute.v2021_03_01.models.ResourceIdentityType + :param user_assigned_identities: The list of user identities associated with the virtual + machine scale set. The user identity dictionary key references will be ARM resource ids in the + form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :type user_assigned_identities: dict[str, + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue}'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue"]] = None, + **kwargs + ): + super(VirtualMachineScaleSetIdentity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue(msrest.serialization.Model): + """VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetIdentityUserAssignedIdentitiesValue, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class VirtualMachineScaleSetInstanceView(msrest.serialization.Model): + """The instance view of a virtual machine scale set. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar virtual_machine: The instance view status summary for the virtual machine scale set. + :vartype virtual_machine: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetInstanceViewStatusesSummary + :ivar extensions: The extensions information. + :vartype extensions: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMExtensionsSummary] + :param statuses: The resource status information. + :type statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + :ivar orchestration_services: The orchestration services information. + :vartype orchestration_services: + list[~azure.mgmt.compute.v2021_03_01.models.OrchestrationServiceSummary] + """ + + _validation = { + 'virtual_machine': {'readonly': True}, + 'extensions': {'readonly': True}, + 'orchestration_services': {'readonly': True}, + } + + _attribute_map = { + 'virtual_machine': {'key': 'virtualMachine', 'type': 'VirtualMachineScaleSetInstanceViewStatusesSummary'}, + 'extensions': {'key': 'extensions', 'type': '[VirtualMachineScaleSetVMExtensionsSummary]'}, + 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, + 'orchestration_services': {'key': 'orchestrationServices', 'type': '[OrchestrationServiceSummary]'}, + } + + def __init__( + self, + *, + statuses: Optional[List["InstanceViewStatus"]] = None, + **kwargs + ): + super(VirtualMachineScaleSetInstanceView, self).__init__(**kwargs) + self.virtual_machine = None + self.extensions = None + self.statuses = statuses + self.orchestration_services = None + + +class VirtualMachineScaleSetInstanceViewStatusesSummary(msrest.serialization.Model): + """Instance view statuses summary for virtual machines of a virtual machine scale set. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar statuses_summary: The extensions information. + :vartype statuses_summary: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineStatusCodeCount] + """ + + _validation = { + 'statuses_summary': {'readonly': True}, + } + + _attribute_map = { + 'statuses_summary': {'key': 'statusesSummary', 'type': '[VirtualMachineStatusCodeCount]'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualMachineScaleSetInstanceViewStatusesSummary, self).__init__(**kwargs) + self.statuses_summary = None + + +class VirtualMachineScaleSetIPConfiguration(SubResource): + """Describes a virtual machine scale set network profile's IP configuration. + + All required parameters must be populated in order to send to Azure. + + :param id: Resource Id. + :type id: str + :param name: Required. The IP configuration name. + :type name: str + :param subnet: Specifies the identifier of the subnet. + :type subnet: ~azure.mgmt.compute.v2021_03_01.models.ApiEntityReference + :param primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :type primary: bool + :param public_ip_address_configuration: The publicIPAddressConfiguration. + :type public_ip_address_configuration: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetPublicIPAddressConfiguration + :param private_ip_address_version: Available from Api-Version 2017-03-30 onwards, it represents + whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible + values are: 'IPv4' and 'IPv6'. Possible values include: "IPv4", "IPv6". + :type private_ip_address_version: str or ~azure.mgmt.compute.v2021_03_01.models.IPVersion + :param application_gateway_backend_address_pools: Specifies an array of references to backend + address pools of application gateways. A scale set can reference backend address pools of + multiple application gateways. Multiple scale sets cannot use the same application gateway. + :type application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + :param application_security_groups: Specifies an array of references to application security + group. + :type application_security_groups: list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + :param load_balancer_backend_address_pools: Specifies an array of references to backend address + pools of load balancers. A scale set can reference backend address pools of one public and one + internal load balancer. Multiple scale sets cannot use the same basic sku load balancer. + :type load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + :param load_balancer_inbound_nat_pools: Specifies an array of references to inbound Nat pools + of the load balancers. A scale set can reference inbound nat pools of one public and one + internal load balancer. Multiple scale sets cannot use the same basic sku load balancer. + :type load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'subnet': {'key': 'properties.subnet', 'type': 'ApiEntityReference'}, + 'primary': {'key': 'properties.primary', 'type': 'bool'}, + 'public_ip_address_configuration': {'key': 'properties.publicIPAddressConfiguration', 'type': 'VirtualMachineScaleSetPublicIPAddressConfiguration'}, + 'private_ip_address_version': {'key': 'properties.privateIPAddressVersion', 'type': 'str'}, + 'application_gateway_backend_address_pools': {'key': 'properties.applicationGatewayBackendAddressPools', 'type': '[SubResource]'}, + 'application_security_groups': {'key': 'properties.applicationSecurityGroups', 'type': '[SubResource]'}, + 'load_balancer_backend_address_pools': {'key': 'properties.loadBalancerBackendAddressPools', 'type': '[SubResource]'}, + 'load_balancer_inbound_nat_pools': {'key': 'properties.loadBalancerInboundNatPools', 'type': '[SubResource]'}, + } + + def __init__( + self, + *, + name: str, + id: Optional[str] = None, + subnet: Optional["ApiEntityReference"] = None, + primary: Optional[bool] = None, + public_ip_address_configuration: Optional["VirtualMachineScaleSetPublicIPAddressConfiguration"] = None, + private_ip_address_version: Optional[Union[str, "IPVersion"]] = None, + application_gateway_backend_address_pools: Optional[List["SubResource"]] = None, + application_security_groups: Optional[List["SubResource"]] = None, + load_balancer_backend_address_pools: Optional[List["SubResource"]] = None, + load_balancer_inbound_nat_pools: Optional[List["SubResource"]] = None, + **kwargs + ): + super(VirtualMachineScaleSetIPConfiguration, self).__init__(id=id, **kwargs) + self.name = name + self.subnet = subnet + self.primary = primary + self.public_ip_address_configuration = public_ip_address_configuration + self.private_ip_address_version = private_ip_address_version + self.application_gateway_backend_address_pools = application_gateway_backend_address_pools + self.application_security_groups = application_security_groups + self.load_balancer_backend_address_pools = load_balancer_backend_address_pools + self.load_balancer_inbound_nat_pools = load_balancer_inbound_nat_pools + + +class VirtualMachineScaleSetIpTag(msrest.serialization.Model): + """Contains the IP tag associated with the public IP address. + + :param ip_tag_type: IP tag type. Example: FirstPartyUsage. + :type ip_tag_type: str + :param tag: IP tag associated with the public IP. Example: SQL, Storage etc. + :type tag: str """ _attribute_map = { - 'load_balancer_configurations': {'key': 'loadBalancerConfigurations', 'type': '[LoadBalancerConfiguration]'}, - 'swappable_cloud_service': {'key': 'swappableCloudService', 'type': 'SubResource'}, + 'ip_tag_type': {'key': 'ipTagType', 'type': 'str'}, + 'tag': {'key': 'tag', 'type': 'str'}, } def __init__( self, *, - load_balancer_configurations: Optional[List["LoadBalancerConfiguration"]] = None, - swappable_cloud_service: Optional["SubResource"] = None, + ip_tag_type: Optional[str] = None, + tag: Optional[str] = None, **kwargs ): - super(CloudServiceNetworkProfile, self).__init__(**kwargs) - self.load_balancer_configurations = load_balancer_configurations - self.swappable_cloud_service = swappable_cloud_service + super(VirtualMachineScaleSetIpTag, self).__init__(**kwargs) + self.ip_tag_type = ip_tag_type + self.tag = tag -class CloudServiceOsProfile(msrest.serialization.Model): - """Describes the OS profile for the cloud service. +class VirtualMachineScaleSetListOSUpgradeHistory(msrest.serialization.Model): + """List of Virtual Machine Scale Set OS Upgrade History operation response. - :param secrets: Specifies set of certificates that should be installed onto the role instances. - :type secrets: list[~azure.mgmt.compute.v2021_03_01.models.CloudServiceVaultSecretGroup] + All required parameters must be populated in order to send to Azure. + + :param value: Required. The list of OS upgrades performed on the virtual machine scale set. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.UpgradeOperationHistoricalStatusInfo] + :param next_link: The uri to fetch the next page of OS Upgrade History. Call ListNext() with + this to fetch the next page of history of upgrades. + :type next_link: str """ + _validation = { + 'value': {'required': True}, + } + _attribute_map = { - 'secrets': {'key': 'secrets', 'type': '[CloudServiceVaultSecretGroup]'}, + 'value': {'key': 'value', 'type': '[UpgradeOperationHistoricalStatusInfo]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, *, - secrets: Optional[List["CloudServiceVaultSecretGroup"]] = None, + value: List["UpgradeOperationHistoricalStatusInfo"], + next_link: Optional[str] = None, **kwargs ): - super(CloudServiceOsProfile, self).__init__(**kwargs) - self.secrets = secrets + super(VirtualMachineScaleSetListOSUpgradeHistory, self).__init__(**kwargs) + self.value = value + self.next_link = next_link -class CloudServiceProperties(msrest.serialization.Model): - """Cloud service properties. +class VirtualMachineScaleSetListResult(msrest.serialization.Model): + """The List Virtual Machine operation response. - 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. - :param package_url: Specifies a URL that refers to the location of the service package in the - Blob service. The service package URL can be Shared Access Signature (SAS) URI from any storage - account. - This is a write-only property and is not returned in GET calls. - :type package_url: str - :param configuration: Specifies the XML service configuration (.cscfg) for the cloud service. - :type configuration: str - :param configuration_url: Specifies a URL that refers to the location of the service - configuration in the Blob service. The service package URL can be Shared Access Signature - (SAS) URI from any storage account. - This is a write-only property and is not returned in GET calls. - :type configuration_url: str - :param start_cloud_service: (Optional) Indicates whether to start the cloud service immediately - after it is created. The default value is ``true``. - If false, the service model is still deployed, but the code is not run immediately. Instead, - the service is PoweredOff until you call Start, at which time the service will be started. A - deployed service still incurs charges, even if it is poweredoff. - :type start_cloud_service: bool - :param allow_model_override: (Optional) Indicates whether the role sku properties - (roleProfile.roles.sku) specified in the model/template should override the role instance count - and vm size specified in the .cscfg and .csdef respectively. - The default value is ``false``. - :type allow_model_override: bool - :param upgrade_mode: Update mode for the cloud service. Role instances are allocated to update - domains when the service is deployed. Updates can be initiated manually in each update domain - or initiated automatically in all update domains. - Possible Values are :code:`
    `:code:`
    `\ **Auto**\ :code:`
    `:code:`
    `\ - **Manual** :code:`
    `:code:`
    `\ **Simultaneous**\ :code:`
    `:code:`
    ` - If not specified, the default value is Auto. If set to Manual, PUT UpdateDomain must be called - to apply the update. If set to Auto, the update is automatically applied to each update domain - in sequence. Possible values include: "Auto", "Manual", "Simultaneous". - :type upgrade_mode: str or ~azure.mgmt.compute.v2021_03_01.models.CloudServiceUpgradeMode - :param role_profile: Describes the role profile for the cloud service. - :type role_profile: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceRoleProfile - :param os_profile: Describes the OS profile for the cloud service. - :type os_profile: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceOsProfile - :param network_profile: Network Profile for the cloud service. - :type network_profile: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceNetworkProfile - :param extension_profile: Describes a cloud service extension profile. - :type extension_profile: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceExtensionProfile - :ivar provisioning_state: The provisioning state, which only appears in the response. - :vartype provisioning_state: str - :ivar unique_id: The unique identifier for the cloud service. - :vartype unique_id: str + :param value: Required. The list of virtual machine scale sets. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSet] + :param next_link: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() + with this to fetch the next page of VMSS. + :type next_link: str """ _validation = { - 'provisioning_state': {'readonly': True}, - 'unique_id': {'readonly': True}, + 'value': {'required': True}, } _attribute_map = { - 'package_url': {'key': 'packageUrl', 'type': 'str'}, - 'configuration': {'key': 'configuration', 'type': 'str'}, - 'configuration_url': {'key': 'configurationUrl', 'type': 'str'}, - 'start_cloud_service': {'key': 'startCloudService', 'type': 'bool'}, - 'allow_model_override': {'key': 'allowModelOverride', 'type': 'bool'}, - 'upgrade_mode': {'key': 'upgradeMode', 'type': 'str'}, - 'role_profile': {'key': 'roleProfile', 'type': 'CloudServiceRoleProfile'}, - 'os_profile': {'key': 'osProfile', 'type': 'CloudServiceOsProfile'}, - 'network_profile': {'key': 'networkProfile', 'type': 'CloudServiceNetworkProfile'}, - 'extension_profile': {'key': 'extensionProfile', 'type': 'CloudServiceExtensionProfile'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'unique_id': {'key': 'uniqueId', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[VirtualMachineScaleSet]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, *, - package_url: Optional[str] = None, - configuration: Optional[str] = None, - configuration_url: Optional[str] = None, - start_cloud_service: Optional[bool] = None, - allow_model_override: Optional[bool] = None, - upgrade_mode: Optional[Union[str, "CloudServiceUpgradeMode"]] = None, - role_profile: Optional["CloudServiceRoleProfile"] = None, - os_profile: Optional["CloudServiceOsProfile"] = None, - network_profile: Optional["CloudServiceNetworkProfile"] = None, - extension_profile: Optional["CloudServiceExtensionProfile"] = None, + value: List["VirtualMachineScaleSet"], + next_link: Optional[str] = None, **kwargs ): - super(CloudServiceProperties, self).__init__(**kwargs) - self.package_url = package_url - self.configuration = configuration - self.configuration_url = configuration_url - self.start_cloud_service = start_cloud_service - self.allow_model_override = allow_model_override - self.upgrade_mode = upgrade_mode - self.role_profile = role_profile - self.os_profile = os_profile - self.network_profile = network_profile - self.extension_profile = extension_profile - self.provisioning_state = None - self.unique_id = None + super(VirtualMachineScaleSetListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link -class CloudServiceRole(msrest.serialization.Model): - """Describes a role of the cloud service. +class VirtualMachineScaleSetListSkusResult(msrest.serialization.Model): + """The Virtual Machine Scale Set List Skus operation response. - 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 id: Resource id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar location: Resource location. - :vartype location: str - :param sku: Describes the cloud service role sku. - :type sku: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceRoleSku - :param properties: - :type properties: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceRoleProperties + :param value: Required. The list of skus available for the virtual machine scale set. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetSku] + :param next_link: The uri to fetch the next page of Virtual Machine Scale Set Skus. Call + ListNext() with this to fetch the next page of VMSS Skus. + :type next_link: str """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, + 'value': {'required': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'CloudServiceRoleSku'}, - 'properties': {'key': 'properties', 'type': 'CloudServiceRoleProperties'}, + 'value': {'key': 'value', 'type': '[VirtualMachineScaleSetSku]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, *, - sku: Optional["CloudServiceRoleSku"] = None, - properties: Optional["CloudServiceRoleProperties"] = None, + value: List["VirtualMachineScaleSetSku"], + next_link: Optional[str] = None, **kwargs ): - super(CloudServiceRole, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = None - self.sku = sku - self.properties = properties + super(VirtualMachineScaleSetListSkusResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link -class CloudServiceRoleListResult(msrest.serialization.Model): - """CloudServiceRoleListResult. +class VirtualMachineScaleSetListWithLinkResult(msrest.serialization.Model): + """The List Virtual Machine operation response. All required parameters must be populated in order to send to Azure. - :param value: Required. - :type value: list[~azure.mgmt.compute.v2021_03_01.models.CloudServiceRole] - :param next_link: + :param value: Required. The list of virtual machine scale sets. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSet] + :param next_link: The uri to fetch the next page of Virtual Machine Scale Sets. Call ListNext() + with this to fetch the next page of Virtual Machine Scale Sets. :type next_link: str """ @@ -547,858 +8963,1647 @@ class CloudServiceRoleListResult(msrest.serialization.Model): } _attribute_map = { - 'value': {'key': 'value', 'type': '[CloudServiceRole]'}, + 'value': {'key': 'value', 'type': '[VirtualMachineScaleSet]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, *, - value: List["CloudServiceRole"], + value: List["VirtualMachineScaleSet"], next_link: Optional[str] = None, **kwargs ): - super(CloudServiceRoleListResult, self).__init__(**kwargs) + super(VirtualMachineScaleSetListWithLinkResult, self).__init__(**kwargs) self.value = value self.next_link = next_link -class CloudServiceRoleProfile(msrest.serialization.Model): - """Describes the role profile for the cloud service. +class VirtualMachineScaleSetManagedDiskParameters(msrest.serialization.Model): + """Describes the parameters of a ScaleSet managed disk. - :param roles: List of roles for the cloud service. - :type roles: list[~azure.mgmt.compute.v2021_03_01.models.CloudServiceRoleProfileProperties] + :param storage_account_type: Specifies the storage account type for the managed disk. NOTE: + UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. Possible values + include: "Standard_LRS", "Premium_LRS", "StandardSSD_LRS", "UltraSSD_LRS", "Premium_ZRS", + "StandardSSD_ZRS". + :type storage_account_type: str or ~azure.mgmt.compute.v2021_03_01.models.StorageAccountTypes + :param disk_encryption_set: Specifies the customer managed disk encryption set resource id for + the managed disk. + :type disk_encryption_set: ~azure.mgmt.compute.v2021_03_01.models.DiskEncryptionSetParameters """ _attribute_map = { - 'roles': {'key': 'roles', 'type': '[CloudServiceRoleProfileProperties]'}, + 'storage_account_type': {'key': 'storageAccountType', 'type': 'str'}, + 'disk_encryption_set': {'key': 'diskEncryptionSet', 'type': 'DiskEncryptionSetParameters'}, } def __init__( self, *, - roles: Optional[List["CloudServiceRoleProfileProperties"]] = None, + storage_account_type: Optional[Union[str, "StorageAccountTypes"]] = None, + disk_encryption_set: Optional["DiskEncryptionSetParameters"] = None, **kwargs ): - super(CloudServiceRoleProfile, self).__init__(**kwargs) - self.roles = roles + super(VirtualMachineScaleSetManagedDiskParameters, self).__init__(**kwargs) + self.storage_account_type = storage_account_type + self.disk_encryption_set = disk_encryption_set -class CloudServiceRoleProfileProperties(msrest.serialization.Model): - """Describes the role properties. +class VirtualMachineScaleSetNetworkConfiguration(SubResource): + """Describes a virtual machine scale set network profile's network configurations. - :param name: Resource name. + All required parameters must be populated in order to send to Azure. + + :param id: Resource Id. + :type id: str + :param name: Required. The network configuration name. :type name: str - :param sku: Describes the cloud service role sku. - :type sku: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceRoleSku + :param primary: Specifies the primary network interface in case the virtual machine has more + than 1 network interface. + :type primary: bool + :param enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :type enable_accelerated_networking: bool + :param enable_fpga: Specifies whether the network interface is FPGA networking-enabled. + :type enable_fpga: bool + :param network_security_group: The network security group. + :type network_security_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param dns_settings: The dns settings to be applied on the network interfaces. + :type dns_settings: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings + :param ip_configurations: Specifies the IP configurations of the network interface. + :type ip_configurations: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetIPConfiguration] + :param enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :type enable_ip_forwarding: bool """ + _validation = { + 'name': {'required': True}, + } + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'CloudServiceRoleSku'}, + 'primary': {'key': 'properties.primary', 'type': 'bool'}, + 'enable_accelerated_networking': {'key': 'properties.enableAcceleratedNetworking', 'type': 'bool'}, + 'enable_fpga': {'key': 'properties.enableFpga', 'type': 'bool'}, + 'network_security_group': {'key': 'properties.networkSecurityGroup', 'type': 'SubResource'}, + 'dns_settings': {'key': 'properties.dnsSettings', 'type': 'VirtualMachineScaleSetNetworkConfigurationDnsSettings'}, + 'ip_configurations': {'key': 'properties.ipConfigurations', 'type': '[VirtualMachineScaleSetIPConfiguration]'}, + 'enable_ip_forwarding': {'key': 'properties.enableIPForwarding', 'type': 'bool'}, } def __init__( self, *, - name: Optional[str] = None, - sku: Optional["CloudServiceRoleSku"] = None, + name: str, + id: Optional[str] = None, + primary: Optional[bool] = None, + enable_accelerated_networking: Optional[bool] = None, + enable_fpga: Optional[bool] = None, + network_security_group: Optional["SubResource"] = None, + dns_settings: Optional["VirtualMachineScaleSetNetworkConfigurationDnsSettings"] = None, + ip_configurations: Optional[List["VirtualMachineScaleSetIPConfiguration"]] = None, + enable_ip_forwarding: Optional[bool] = None, **kwargs ): - super(CloudServiceRoleProfileProperties, self).__init__(**kwargs) + super(VirtualMachineScaleSetNetworkConfiguration, self).__init__(id=id, **kwargs) self.name = name - self.sku = sku - + self.primary = primary + self.enable_accelerated_networking = enable_accelerated_networking + self.enable_fpga = enable_fpga + self.network_security_group = network_security_group + self.dns_settings = dns_settings + self.ip_configurations = ip_configurations + self.enable_ip_forwarding = enable_ip_forwarding -class CloudServiceRoleProperties(msrest.serialization.Model): - """CloudServiceRoleProperties. - Variables are only populated by the server, and will be ignored when sending a request. +class VirtualMachineScaleSetNetworkConfigurationDnsSettings(msrest.serialization.Model): + """Describes a virtual machines scale sets network configuration's DNS settings. - :ivar unique_id: Specifies the ID which uniquely identifies a cloud service role. - :vartype unique_id: str + :param dns_servers: List of DNS servers IP addresses. + :type dns_servers: list[str] """ - _validation = { - 'unique_id': {'readonly': True}, - } - _attribute_map = { - 'unique_id': {'key': 'uniqueId', 'type': 'str'}, + 'dns_servers': {'key': 'dnsServers', 'type': '[str]'}, } def __init__( self, + *, + dns_servers: Optional[List[str]] = None, **kwargs ): - super(CloudServiceRoleProperties, self).__init__(**kwargs) - self.unique_id = None + super(VirtualMachineScaleSetNetworkConfigurationDnsSettings, self).__init__(**kwargs) + self.dns_servers = dns_servers -class CloudServiceRoleSku(msrest.serialization.Model): - """Describes the cloud service role sku. +class VirtualMachineScaleSetNetworkProfile(msrest.serialization.Model): + """Describes a virtual machine scale set network profile. - :param name: The sku name. NOTE: If the new SKU is not supported on the hardware the cloud - service is currently on, you need to delete and recreate the cloud service or move back to the - old sku. - :type name: str - :param tier: Specifies the tier of the cloud service. Possible Values are :code:`
    `:code:`
    ` **Standard** :code:`
    `:code:`
    ` **Basic**. - :type tier: str - :param capacity: Specifies the number of role instances in the cloud service. - :type capacity: long + :param health_probe: A reference to a load balancer probe used to determine the health of an + instance in the virtual machine scale set. The reference will be in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. + :type health_probe: ~azure.mgmt.compute.v2021_03_01.models.ApiEntityReference + :param network_interface_configurations: The list of network configurations. + :type network_interface_configurations: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetNetworkConfiguration] """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'long'}, + 'health_probe': {'key': 'healthProbe', 'type': 'ApiEntityReference'}, + 'network_interface_configurations': {'key': 'networkInterfaceConfigurations', 'type': '[VirtualMachineScaleSetNetworkConfiguration]'}, } def __init__( self, *, - name: Optional[str] = None, - tier: Optional[str] = None, - capacity: Optional[int] = None, + health_probe: Optional["ApiEntityReference"] = None, + network_interface_configurations: Optional[List["VirtualMachineScaleSetNetworkConfiguration"]] = None, **kwargs ): - super(CloudServiceRoleSku, self).__init__(**kwargs) - self.name = name - self.tier = tier - self.capacity = capacity + super(VirtualMachineScaleSetNetworkProfile, self).__init__(**kwargs) + self.health_probe = health_probe + self.network_interface_configurations = network_interface_configurations -class CloudServiceUpdate(msrest.serialization.Model): - """CloudServiceUpdate. +class VirtualMachineScaleSetOSDisk(msrest.serialization.Model): + """Describes a virtual machine scale set operating system disk. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + All required parameters must be populated in order to send to Azure. + + :param name: The disk name. + :type name: str + :param caching: Specifies the caching requirements. :code:`
    `:code:`
    ` Possible values + are: :code:`
    `:code:`
    ` **None** :code:`
    `:code:`
    ` **ReadOnly** + :code:`
    `:code:`
    ` **ReadWrite** :code:`
    `:code:`
    ` Default: **None for Standard + storage. ReadOnly for Premium storage**. Possible values include: "None", "ReadOnly", + "ReadWrite". + :type caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes + :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :type write_accelerator_enabled: bool + :param create_option: Required. Specifies how the virtual machines in the scale set should be + created.:code:`
    `:code:`
    ` The only allowed value is: **FromImage** \u2013 This value is + used when you are using an image to create the virtual machine. If you are using a platform + image, you also use the imageReference element described above. If you are using a marketplace + image, you also use the plan element previously described. Possible values include: + "FromImage", "Empty", "Attach". + :type create_option: str or ~azure.mgmt.compute.v2021_03_01.models.DiskCreateOptionTypes + :param diff_disk_settings: Specifies the ephemeral disk Settings for the operating system disk + used by the virtual machine scale set. + :type diff_disk_settings: ~azure.mgmt.compute.v2021_03_01.models.DiffDiskSettings + :param disk_size_gb: Specifies the size of the operating system disk in gigabytes. This element + can be used to overwrite the size of the disk in a virtual machine image. + :code:`
    `:code:`
    ` This value cannot be larger than 1023 GB. + :type disk_size_gb: int + :param os_type: This property allows you to specify the type of the OS that is included in the + disk if creating a VM from user-image or a specialized VHD. :code:`
    `:code:`
    ` Possible + values are: :code:`
    `:code:`
    ` **Windows** :code:`
    `:code:`
    ` **Linux**. Possible + values include: "Windows", "Linux". + :type os_type: str or ~azure.mgmt.compute.v2021_03_01.models.OperatingSystemTypes + :param image: Specifies information about the unmanaged user image to base the scale set on. + :type image: ~azure.mgmt.compute.v2021_03_01.models.VirtualHardDisk + :param vhd_containers: Specifies the container urls that are used to store operating system + disks for the scale set. + :type vhd_containers: list[str] + :param managed_disk: The managed disk parameters. + :type managed_disk: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetManagedDiskParameters """ + _validation = { + 'create_option': {'required': True}, + } + _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, + 'name': {'key': 'name', 'type': 'str'}, + 'caching': {'key': 'caching', 'type': 'str'}, + 'write_accelerator_enabled': {'key': 'writeAcceleratorEnabled', 'type': 'bool'}, + 'create_option': {'key': 'createOption', 'type': 'str'}, + 'diff_disk_settings': {'key': 'diffDiskSettings', 'type': 'DiffDiskSettings'}, + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, + 'os_type': {'key': 'osType', 'type': 'str'}, + 'image': {'key': 'image', 'type': 'VirtualHardDisk'}, + 'vhd_containers': {'key': 'vhdContainers', 'type': '[str]'}, + 'managed_disk': {'key': 'managedDisk', 'type': 'VirtualMachineScaleSetManagedDiskParameters'}, } def __init__( self, *, - tags: Optional[Dict[str, str]] = None, + create_option: Union[str, "DiskCreateOptionTypes"], + name: Optional[str] = None, + caching: Optional[Union[str, "CachingTypes"]] = None, + write_accelerator_enabled: Optional[bool] = None, + diff_disk_settings: Optional["DiffDiskSettings"] = None, + disk_size_gb: Optional[int] = None, + os_type: Optional[Union[str, "OperatingSystemTypes"]] = None, + image: Optional["VirtualHardDisk"] = None, + vhd_containers: Optional[List[str]] = None, + managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, **kwargs ): - super(CloudServiceUpdate, self).__init__(**kwargs) - self.tags = tags - - -class CloudServiceVaultAndSecretReference(msrest.serialization.Model): - """CloudServiceVaultAndSecretReference. - - :param source_vault: - :type source_vault: ~azure.mgmt.compute.v2021_03_01.models.SubResource - :param secret_url: - :type secret_url: str + super(VirtualMachineScaleSetOSDisk, self).__init__(**kwargs) + self.name = name + self.caching = caching + self.write_accelerator_enabled = write_accelerator_enabled + self.create_option = create_option + self.diff_disk_settings = diff_disk_settings + self.disk_size_gb = disk_size_gb + self.os_type = os_type + self.image = image + self.vhd_containers = vhd_containers + self.managed_disk = managed_disk + + +class VirtualMachineScaleSetOSProfile(msrest.serialization.Model): + """Describes a virtual machine scale set OS profile. + + :param computer_name_prefix: Specifies the computer name prefix for all of the virtual machines + in the scale set. Computer name prefixes must be 1 to 15 characters long. + :type computer_name_prefix: str + :param admin_username: Specifies the name of the administrator account. + :code:`
    `:code:`
    ` **Windows-only restriction:** Cannot end in "." + :code:`
    `:code:`
    ` **Disallowed values:** "administrator", "admin", "user", "user1", + "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", + "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", + "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". + :code:`
    `:code:`
    ` **Minimum-length (Linux):** 1 character :code:`
    `:code:`
    ` + **Max-length (Linux):** 64 characters :code:`
    `:code:`
    ` **Max-length (Windows):** 20 + characters :code:`
    `:code:`
    `:code:`
  • ` For root access to the Linux VM, see `Using + root privileges on Linux virtual machines in Azure `_\ :code:`
    `:code:`
  • ` For a list of built-in system users on + Linux that should not be used in this field, see `Selecting User Names for Linux on Azure + `_. + :type admin_username: str + :param admin_password: Specifies the password of the administrator account. + :code:`
    `:code:`
    ` **Minimum-length (Windows):** 8 characters :code:`
    `:code:`
    ` + **Minimum-length (Linux):** 6 characters :code:`
    `:code:`
    ` **Max-length (Windows):** 123 + characters :code:`
    `:code:`
    ` **Max-length (Linux):** 72 characters + :code:`
    `:code:`
    ` **Complexity requirements:** 3 out of 4 conditions below need to be + fulfilled :code:`
    ` Has lower characters :code:`
    `Has upper characters :code:`
    ` Has a + digit :code:`
    ` Has a special character (Regex match [\W_]) :code:`
    `:code:`
    ` + **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", + "pass@word1", "Password!", "Password1", "Password22", "iloveyou!" :code:`
    `:code:`
    ` For + resetting the password, see `How to reset the Remote Desktop service or its login password in a + Windows VM `_ :code:`
    `:code:`
    ` For + resetting root password, see `Manage users, SSH, and check or repair disks on Azure Linux VMs + using the VMAccess Extension `_. + :type admin_password: str + :param custom_data: Specifies a base-64 encoded string of custom data. The base-64 encoded + string is decoded to a binary array that is saved as a file on the Virtual Machine. The maximum + length of the binary array is 65535 bytes. :code:`
    `:code:`
    ` For using cloud-init for + your VM, see `Using cloud-init to customize a Linux VM during creation + `_. + :type custom_data: str + :param windows_configuration: Specifies Windows operating system settings on the virtual + machine. + :type windows_configuration: ~azure.mgmt.compute.v2021_03_01.models.WindowsConfiguration + :param linux_configuration: Specifies the Linux operating system settings on the virtual + machine. :code:`
    `:code:`
    `For a list of supported Linux distributions, see `Linux on + Azure-Endorsed Distributions `_ + :code:`
    `:code:`
    ` For running non-endorsed distributions, see `Information for Non- + Endorsed Distributions `_. + :type linux_configuration: ~azure.mgmt.compute.v2021_03_01.models.LinuxConfiguration + :param secrets: Specifies set of certificates that should be installed onto the virtual + machines in the scale set. + :type secrets: list[~azure.mgmt.compute.v2021_03_01.models.VaultSecretGroup] """ _attribute_map = { - 'source_vault': {'key': 'sourceVault', 'type': 'SubResource'}, - 'secret_url': {'key': 'secretUrl', 'type': 'str'}, + 'computer_name_prefix': {'key': 'computerNamePrefix', 'type': 'str'}, + 'admin_username': {'key': 'adminUsername', 'type': 'str'}, + 'admin_password': {'key': 'adminPassword', 'type': 'str'}, + 'custom_data': {'key': 'customData', 'type': 'str'}, + 'windows_configuration': {'key': 'windowsConfiguration', 'type': 'WindowsConfiguration'}, + 'linux_configuration': {'key': 'linuxConfiguration', 'type': 'LinuxConfiguration'}, + 'secrets': {'key': 'secrets', 'type': '[VaultSecretGroup]'}, } def __init__( self, *, - source_vault: Optional["SubResource"] = None, - secret_url: Optional[str] = None, + computer_name_prefix: Optional[str] = None, + admin_username: Optional[str] = None, + admin_password: Optional[str] = None, + custom_data: Optional[str] = None, + windows_configuration: Optional["WindowsConfiguration"] = None, + linux_configuration: Optional["LinuxConfiguration"] = None, + secrets: Optional[List["VaultSecretGroup"]] = None, **kwargs ): - super(CloudServiceVaultAndSecretReference, self).__init__(**kwargs) - self.source_vault = source_vault - self.secret_url = secret_url + super(VirtualMachineScaleSetOSProfile, self).__init__(**kwargs) + self.computer_name_prefix = computer_name_prefix + self.admin_username = admin_username + self.admin_password = admin_password + self.custom_data = custom_data + self.windows_configuration = windows_configuration + self.linux_configuration = linux_configuration + self.secrets = secrets -class CloudServiceVaultCertificate(msrest.serialization.Model): - """Describes a single certificate reference in a Key Vault, and where the certificate should reside on the role instance. +class VirtualMachineScaleSetPublicIPAddressConfiguration(msrest.serialization.Model): + """Describes a virtual machines scale set IP Configuration's PublicIPAddress configuration. - :param certificate_url: This is the URL of a certificate that has been uploaded to Key Vault as - a secret. - :type certificate_url: str + All required parameters must be populated in order to send to Azure. + + :param name: Required. The publicIP address configuration name. + :type name: str + :param idle_timeout_in_minutes: The idle timeout of the public IP address. + :type idle_timeout_in_minutes: int + :param dns_settings: The dns settings to be applied on the publicIP addresses . + :type dns_settings: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings + :param ip_tags: The list of IP tags associated with the public IP address. + :type ip_tags: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetIpTag] + :param public_ip_prefix: The PublicIPPrefix from which to allocate publicIP addresses. + :type public_ip_prefix: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param public_ip_address_version: Available from Api-Version 2019-07-01 onwards, it represents + whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values + are: 'IPv4' and 'IPv6'. Possible values include: "IPv4", "IPv6". + :type public_ip_address_version: str or ~azure.mgmt.compute.v2021_03_01.models.IPVersion """ + _validation = { + 'name': {'required': True}, + } + _attribute_map = { - 'certificate_url': {'key': 'certificateUrl', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'idle_timeout_in_minutes': {'key': 'properties.idleTimeoutInMinutes', 'type': 'int'}, + 'dns_settings': {'key': 'properties.dnsSettings', 'type': 'VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings'}, + 'ip_tags': {'key': 'properties.ipTags', 'type': '[VirtualMachineScaleSetIpTag]'}, + 'public_ip_prefix': {'key': 'properties.publicIPPrefix', 'type': 'SubResource'}, + 'public_ip_address_version': {'key': 'properties.publicIPAddressVersion', 'type': 'str'}, } def __init__( self, *, - certificate_url: Optional[str] = None, + name: str, + idle_timeout_in_minutes: Optional[int] = None, + dns_settings: Optional["VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings"] = None, + ip_tags: Optional[List["VirtualMachineScaleSetIpTag"]] = None, + public_ip_prefix: Optional["SubResource"] = None, + public_ip_address_version: Optional[Union[str, "IPVersion"]] = None, **kwargs ): - super(CloudServiceVaultCertificate, self).__init__(**kwargs) - self.certificate_url = certificate_url + super(VirtualMachineScaleSetPublicIPAddressConfiguration, self).__init__(**kwargs) + self.name = name + self.idle_timeout_in_minutes = idle_timeout_in_minutes + self.dns_settings = dns_settings + self.ip_tags = ip_tags + self.public_ip_prefix = public_ip_prefix + self.public_ip_address_version = public_ip_address_version -class CloudServiceVaultSecretGroup(msrest.serialization.Model): - """Describes a set of certificates which are all in the same Key Vault. +class VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings(msrest.serialization.Model): + """Describes a virtual machines scale sets network configuration's DNS settings. - :param source_vault: The relative URL of the Key Vault containing all of the certificates in - VaultCertificates. - :type source_vault: ~azure.mgmt.compute.v2021_03_01.models.SubResource - :param vault_certificates: The list of key vault references in SourceVault which contain - certificates. - :type vault_certificates: - list[~azure.mgmt.compute.v2021_03_01.models.CloudServiceVaultCertificate] + All required parameters must be populated in order to send to Azure. + + :param domain_name_label: Required. The Domain name label.The concatenation of the domain name + label and vm index will be the domain name labels of the PublicIPAddress resources that will be + created. + :type domain_name_label: str """ + _validation = { + 'domain_name_label': {'required': True}, + } + _attribute_map = { - 'source_vault': {'key': 'sourceVault', 'type': 'SubResource'}, - 'vault_certificates': {'key': 'vaultCertificates', 'type': '[CloudServiceVaultCertificate]'}, + 'domain_name_label': {'key': 'domainNameLabel', 'type': 'str'}, } def __init__( self, *, - source_vault: Optional["SubResource"] = None, - vault_certificates: Optional[List["CloudServiceVaultCertificate"]] = None, + domain_name_label: str, **kwargs ): - super(CloudServiceVaultSecretGroup, self).__init__(**kwargs) - self.source_vault = source_vault - self.vault_certificates = vault_certificates + super(VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings, self).__init__(**kwargs) + self.domain_name_label = domain_name_label -class Extension(msrest.serialization.Model): - """Describes a cloud service Extension. +class VirtualMachineScaleSetVMReimageParameters(VirtualMachineReimageParameters): + """Describes a Virtual Machine Scale Set VM Reimage Parameters. - :param name: The name of the extension. - :type name: str - :param properties: Extension Properties. - :type properties: ~azure.mgmt.compute.v2021_03_01.models.CloudServiceExtensionProperties + :param temp_disk: Specifies whether to reimage temp disk. Default value: false. Note: This temp + disk reimage parameter is only supported for VM/VMSS with Ephemeral OS disk. + :type temp_disk: bool """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'CloudServiceExtensionProperties'}, + 'temp_disk': {'key': 'tempDisk', 'type': 'bool'}, } def __init__( self, *, - name: Optional[str] = None, - properties: Optional["CloudServiceExtensionProperties"] = None, + temp_disk: Optional[bool] = None, **kwargs ): - super(Extension, self).__init__(**kwargs) - self.name = name - self.properties = properties + super(VirtualMachineScaleSetVMReimageParameters, self).__init__(temp_disk=temp_disk, **kwargs) -class InnerError(msrest.serialization.Model): - """Inner error details. +class VirtualMachineScaleSetReimageParameters(VirtualMachineScaleSetVMReimageParameters): + """Describes a Virtual Machine Scale Set VM Reimage Parameters. - :param exceptiontype: The exception type. - :type exceptiontype: str - :param errordetail: The internal error message or exception dump. - :type errordetail: str + :param temp_disk: Specifies whether to reimage temp disk. Default value: false. Note: This temp + disk reimage parameter is only supported for VM/VMSS with Ephemeral OS disk. + :type temp_disk: bool + :param instance_ids: The virtual machine scale set instance ids. Omitting the virtual machine + scale set instance ids will result in the operation being performed on all virtual machines in + the virtual machine scale set. + :type instance_ids: list[str] """ _attribute_map = { - 'exceptiontype': {'key': 'exceptiontype', 'type': 'str'}, - 'errordetail': {'key': 'errordetail', 'type': 'str'}, + 'temp_disk': {'key': 'tempDisk', 'type': 'bool'}, + 'instance_ids': {'key': 'instanceIds', 'type': '[str]'}, } def __init__( self, *, - exceptiontype: Optional[str] = None, - errordetail: Optional[str] = None, + temp_disk: Optional[bool] = None, + instance_ids: Optional[List[str]] = None, **kwargs ): - super(InnerError, self).__init__(**kwargs) - self.exceptiontype = exceptiontype - self.errordetail = errordetail + super(VirtualMachineScaleSetReimageParameters, self).__init__(temp_disk=temp_disk, **kwargs) + self.instance_ids = instance_ids -class InstanceSku(msrest.serialization.Model): - """InstanceSku. +class VirtualMachineScaleSetSku(msrest.serialization.Model): + """Describes an available virtual machine scale set sku. Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: The sku name. - :vartype name: str - :ivar tier: The tier of the cloud service role instance. - :vartype tier: str + :ivar resource_type: The type of resource the sku applies to. + :vartype resource_type: str + :ivar sku: The Sku. + :vartype sku: ~azure.mgmt.compute.v2021_03_01.models.Sku + :ivar capacity: Specifies the number of virtual machines in the scale set. + :vartype capacity: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetSkuCapacity """ _validation = { - 'name': {'readonly': True}, - 'tier': {'readonly': True}, + 'resource_type': {'readonly': True}, + 'sku': {'readonly': True}, + 'capacity': {'readonly': True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'capacity': {'key': 'capacity', 'type': 'VirtualMachineScaleSetSkuCapacity'}, } def __init__( self, **kwargs ): - super(InstanceSku, self).__init__(**kwargs) - self.name = None - self.tier = None + super(VirtualMachineScaleSetSku, self).__init__(**kwargs) + self.resource_type = None + self.sku = None + self.capacity = None -class InstanceViewStatusesSummary(msrest.serialization.Model): - """Instance view statuses. +class VirtualMachineScaleSetSkuCapacity(msrest.serialization.Model): + """Describes scaling information of a sku. Variables are only populated by the server, and will be ignored when sending a request. - :ivar statuses_summary: - :vartype statuses_summary: list[~azure.mgmt.compute.v2021_03_01.models.StatusCodeCount] + :ivar minimum: The minimum capacity. + :vartype minimum: long + :ivar maximum: The maximum capacity that can be set. + :vartype maximum: long + :ivar default_capacity: The default capacity. + :vartype default_capacity: long + :ivar scale_type: The scale type applicable to the sku. Possible values include: "Automatic", + "None". + :vartype scale_type: str or + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetSkuScaleType """ _validation = { - 'statuses_summary': {'readonly': True}, + 'minimum': {'readonly': True}, + 'maximum': {'readonly': True}, + 'default_capacity': {'readonly': True}, + 'scale_type': {'readonly': True}, } _attribute_map = { - 'statuses_summary': {'key': 'statusesSummary', 'type': '[StatusCodeCount]'}, + 'minimum': {'key': 'minimum', 'type': 'long'}, + 'maximum': {'key': 'maximum', 'type': 'long'}, + 'default_capacity': {'key': 'defaultCapacity', 'type': 'long'}, + 'scale_type': {'key': 'scaleType', 'type': 'str'}, } def __init__( self, **kwargs ): - super(InstanceViewStatusesSummary, self).__init__(**kwargs) - self.statuses_summary = None + super(VirtualMachineScaleSetSkuCapacity, self).__init__(**kwargs) + self.minimum = None + self.maximum = None + self.default_capacity = None + self.scale_type = None + + +class VirtualMachineScaleSetStorageProfile(msrest.serialization.Model): + """Describes a virtual machine scale set storage profile. + + :param image_reference: Specifies information about the image to use. You can specify + information about platform images, marketplace images, or virtual machine images. This element + is required when you want to use a platform image, marketplace image, or virtual machine image, + but is not used in other creation operations. + :type image_reference: ~azure.mgmt.compute.v2021_03_01.models.ImageReference + :param os_disk: Specifies information about the operating system disk used by the virtual + machines in the scale set. :code:`
    `:code:`
    ` For more information about disks, see + `About disks and VHDs for Azure virtual machines `_. + :type os_disk: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetOSDisk + :param data_disks: Specifies the parameters that are used to add data disks to the virtual + machines in the scale set. :code:`
    `:code:`
    ` For more information about disks, see + `About disks and VHDs for Azure virtual machines `_. + :type data_disks: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetDataDisk] + """ + _attribute_map = { + 'image_reference': {'key': 'imageReference', 'type': 'ImageReference'}, + 'os_disk': {'key': 'osDisk', 'type': 'VirtualMachineScaleSetOSDisk'}, + 'data_disks': {'key': 'dataDisks', 'type': '[VirtualMachineScaleSetDataDisk]'}, + } -class LoadBalancerConfiguration(msrest.serialization.Model): - """Describes the load balancer configuration. + def __init__( + self, + *, + image_reference: Optional["ImageReference"] = None, + os_disk: Optional["VirtualMachineScaleSetOSDisk"] = None, + data_disks: Optional[List["VirtualMachineScaleSetDataDisk"]] = None, + **kwargs + ): + super(VirtualMachineScaleSetStorageProfile, self).__init__(**kwargs) + self.image_reference = image_reference + self.os_disk = os_disk + self.data_disks = data_disks - All required parameters must be populated in order to send to Azure. + +class VirtualMachineScaleSetUpdate(UpdateResource): + """Describes a Virtual Machine Scale Set. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: The virtual machine scale set sku. + :type sku: ~azure.mgmt.compute.v2021_03_01.models.Sku + :param plan: The purchase plan when deploying a virtual machine scale set from VM Marketplace + images. + :type plan: ~azure.mgmt.compute.v2021_03_01.models.Plan + :param identity: The identity of the virtual machine scale set, if configured. + :type identity: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetIdentity + :param upgrade_policy: The upgrade policy. + :type upgrade_policy: ~azure.mgmt.compute.v2021_03_01.models.UpgradePolicy + :param automatic_repairs_policy: Policy for automatic repairs. + :type automatic_repairs_policy: ~azure.mgmt.compute.v2021_03_01.models.AutomaticRepairsPolicy + :param virtual_machine_profile: The virtual machine profile. + :type virtual_machine_profile: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetUpdateVMProfile + :param overprovision: Specifies whether the Virtual Machine Scale Set should be + overprovisioned. + :type overprovision: bool + :param do_not_run_extensions_on_overprovisioned_v_ms: When Overprovision is enabled, extensions + are launched only on the requested number of VMs which are finally kept. This property will + hence ensure that the extensions do not run on the extra overprovisioned VMs. + :type do_not_run_extensions_on_overprovisioned_v_ms: bool + :param single_placement_group: When true this limits the scale set to a single placement group, + of max size 100 virtual machines. NOTE: If singlePlacementGroup is true, it may be modified to + false. However, if singlePlacementGroup is false, it may not be modified to true. + :type single_placement_group: bool + :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + Virtual Machines in the Virtual Machine Scale Set. For instance: whether the Virtual Machines + have the capability to support attaching managed data disks with UltraSSD_LRS storage account + type. + :type additional_capabilities: ~azure.mgmt.compute.v2021_03_01.models.AdditionalCapabilities + :param scale_in_policy: Specifies the scale-in policy that decides which virtual machines are + chosen for removal when a Virtual Machine Scale Set is scaled-in. + :type scale_in_policy: ~azure.mgmt.compute.v2021_03_01.models.ScaleInPolicy + :param proximity_placement_group: Specifies information about the proximity placement group + that the virtual machine scale set should be assigned to. :code:`
    `:code:`
    `Minimum api- + version: 2018-04-01. + :type proximity_placement_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'plan': {'key': 'plan', 'type': 'Plan'}, + 'identity': {'key': 'identity', 'type': 'VirtualMachineScaleSetIdentity'}, + 'upgrade_policy': {'key': 'properties.upgradePolicy', 'type': 'UpgradePolicy'}, + 'automatic_repairs_policy': {'key': 'properties.automaticRepairsPolicy', 'type': 'AutomaticRepairsPolicy'}, + 'virtual_machine_profile': {'key': 'properties.virtualMachineProfile', 'type': 'VirtualMachineScaleSetUpdateVMProfile'}, + 'overprovision': {'key': 'properties.overprovision', 'type': 'bool'}, + 'do_not_run_extensions_on_overprovisioned_v_ms': {'key': 'properties.doNotRunExtensionsOnOverprovisionedVMs', 'type': 'bool'}, + 'single_placement_group': {'key': 'properties.singlePlacementGroup', 'type': 'bool'}, + 'additional_capabilities': {'key': 'properties.additionalCapabilities', 'type': 'AdditionalCapabilities'}, + 'scale_in_policy': {'key': 'properties.scaleInPolicy', 'type': 'ScaleInPolicy'}, + 'proximity_placement_group': {'key': 'properties.proximityPlacementGroup', 'type': 'SubResource'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + sku: Optional["Sku"] = None, + plan: Optional["Plan"] = None, + identity: Optional["VirtualMachineScaleSetIdentity"] = None, + upgrade_policy: Optional["UpgradePolicy"] = None, + automatic_repairs_policy: Optional["AutomaticRepairsPolicy"] = None, + virtual_machine_profile: Optional["VirtualMachineScaleSetUpdateVMProfile"] = None, + overprovision: Optional[bool] = None, + do_not_run_extensions_on_overprovisioned_v_ms: Optional[bool] = None, + single_placement_group: Optional[bool] = None, + additional_capabilities: Optional["AdditionalCapabilities"] = None, + scale_in_policy: Optional["ScaleInPolicy"] = None, + proximity_placement_group: Optional["SubResource"] = None, + **kwargs + ): + super(VirtualMachineScaleSetUpdate, self).__init__(tags=tags, **kwargs) + self.sku = sku + self.plan = plan + self.identity = identity + self.upgrade_policy = upgrade_policy + self.automatic_repairs_policy = automatic_repairs_policy + self.virtual_machine_profile = virtual_machine_profile + self.overprovision = overprovision + self.do_not_run_extensions_on_overprovisioned_v_ms = do_not_run_extensions_on_overprovisioned_v_ms + self.single_placement_group = single_placement_group + self.additional_capabilities = additional_capabilities + self.scale_in_policy = scale_in_policy + self.proximity_placement_group = proximity_placement_group + + +class VirtualMachineScaleSetUpdateIPConfiguration(SubResource): + """Describes a virtual machine scale set network profile's IP configuration. NOTE: The subnet of a scale set may be modified as long as the original subnet and the new subnet are in the same virtual network. :param id: Resource Id. :type id: str - :param name: Required. The name of the Load balancer. + :param name: The IP configuration name. :type name: str - :param properties: Required. Properties of the load balancer configuration. - :type properties: ~azure.mgmt.compute.v2021_03_01.models.LoadBalancerConfigurationProperties + :param subnet: The subnet. + :type subnet: ~azure.mgmt.compute.v2021_03_01.models.ApiEntityReference + :param primary: Specifies the primary IP Configuration in case the network interface has more + than one IP Configuration. + :type primary: bool + :param public_ip_address_configuration: The publicIPAddressConfiguration. + :type public_ip_address_configuration: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration + :param private_ip_address_version: Available from Api-Version 2017-03-30 onwards, it represents + whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible + values are: 'IPv4' and 'IPv6'. Possible values include: "IPv4", "IPv6". + :type private_ip_address_version: str or ~azure.mgmt.compute.v2021_03_01.models.IPVersion + :param application_gateway_backend_address_pools: The application gateway backend address + pools. + :type application_gateway_backend_address_pools: + list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + :param application_security_groups: Specifies an array of references to application security + group. + :type application_security_groups: list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + :param load_balancer_backend_address_pools: The load balancer backend address pools. + :type load_balancer_backend_address_pools: + list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + :param load_balancer_inbound_nat_pools: The load balancer inbound nat pools. + :type load_balancer_inbound_nat_pools: list[~azure.mgmt.compute.v2021_03_01.models.SubResource] """ - _validation = { - 'name': {'required': True}, - 'properties': {'required': True}, - } - _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'LoadBalancerConfigurationProperties'}, + 'subnet': {'key': 'properties.subnet', 'type': 'ApiEntityReference'}, + 'primary': {'key': 'properties.primary', 'type': 'bool'}, + 'public_ip_address_configuration': {'key': 'properties.publicIPAddressConfiguration', 'type': 'VirtualMachineScaleSetUpdatePublicIPAddressConfiguration'}, + 'private_ip_address_version': {'key': 'properties.privateIPAddressVersion', 'type': 'str'}, + 'application_gateway_backend_address_pools': {'key': 'properties.applicationGatewayBackendAddressPools', 'type': '[SubResource]'}, + 'application_security_groups': {'key': 'properties.applicationSecurityGroups', 'type': '[SubResource]'}, + 'load_balancer_backend_address_pools': {'key': 'properties.loadBalancerBackendAddressPools', 'type': '[SubResource]'}, + 'load_balancer_inbound_nat_pools': {'key': 'properties.loadBalancerInboundNatPools', 'type': '[SubResource]'}, } def __init__( self, *, - name: str, - properties: "LoadBalancerConfigurationProperties", id: Optional[str] = None, + name: Optional[str] = None, + subnet: Optional["ApiEntityReference"] = None, + primary: Optional[bool] = None, + public_ip_address_configuration: Optional["VirtualMachineScaleSetUpdatePublicIPAddressConfiguration"] = None, + private_ip_address_version: Optional[Union[str, "IPVersion"]] = None, + application_gateway_backend_address_pools: Optional[List["SubResource"]] = None, + application_security_groups: Optional[List["SubResource"]] = None, + load_balancer_backend_address_pools: Optional[List["SubResource"]] = None, + load_balancer_inbound_nat_pools: Optional[List["SubResource"]] = None, **kwargs ): - super(LoadBalancerConfiguration, self).__init__(**kwargs) - self.id = id + super(VirtualMachineScaleSetUpdateIPConfiguration, self).__init__(id=id, **kwargs) self.name = name - self.properties = properties - + self.subnet = subnet + self.primary = primary + self.public_ip_address_configuration = public_ip_address_configuration + self.private_ip_address_version = private_ip_address_version + self.application_gateway_backend_address_pools = application_gateway_backend_address_pools + self.application_security_groups = application_security_groups + self.load_balancer_backend_address_pools = load_balancer_backend_address_pools + self.load_balancer_inbound_nat_pools = load_balancer_inbound_nat_pools -class LoadBalancerConfigurationProperties(msrest.serialization.Model): - """LoadBalancerConfigurationProperties. - All required parameters must be populated in order to send to Azure. +class VirtualMachineScaleSetUpdateNetworkConfiguration(SubResource): + """Describes a virtual machine scale set network profile's network configurations. - :param frontend_ip_configurations: Required. Specifies the frontend IP to be used for the load - balancer. Only IPv4 frontend IP address is supported. Each load balancer configuration must - have exactly one frontend IP configuration. - :type frontend_ip_configurations: - list[~azure.mgmt.compute.v2021_03_01.models.LoadBalancerFrontendIPConfiguration] + :param id: Resource Id. + :type id: str + :param name: The network configuration name. + :type name: str + :param primary: Whether this is a primary NIC on a virtual machine. + :type primary: bool + :param enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :type enable_accelerated_networking: bool + :param enable_fpga: Specifies whether the network interface is FPGA networking-enabled. + :type enable_fpga: bool + :param network_security_group: The network security group. + :type network_security_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param dns_settings: The dns settings to be applied on the network interfaces. + :type dns_settings: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetNetworkConfigurationDnsSettings + :param ip_configurations: The virtual machine scale set IP Configuration. + :type ip_configurations: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetUpdateIPConfiguration] + :param enable_ip_forwarding: Whether IP forwarding enabled on this NIC. + :type enable_ip_forwarding: bool """ - _validation = { - 'frontend_ip_configurations': {'required': True}, - } - _attribute_map = { - 'frontend_ip_configurations': {'key': 'frontendIPConfigurations', 'type': '[LoadBalancerFrontendIPConfiguration]'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'primary': {'key': 'properties.primary', 'type': 'bool'}, + 'enable_accelerated_networking': {'key': 'properties.enableAcceleratedNetworking', 'type': 'bool'}, + 'enable_fpga': {'key': 'properties.enableFpga', 'type': 'bool'}, + 'network_security_group': {'key': 'properties.networkSecurityGroup', 'type': 'SubResource'}, + 'dns_settings': {'key': 'properties.dnsSettings', 'type': 'VirtualMachineScaleSetNetworkConfigurationDnsSettings'}, + 'ip_configurations': {'key': 'properties.ipConfigurations', 'type': '[VirtualMachineScaleSetUpdateIPConfiguration]'}, + 'enable_ip_forwarding': {'key': 'properties.enableIPForwarding', 'type': 'bool'}, } def __init__( self, *, - frontend_ip_configurations: List["LoadBalancerFrontendIPConfiguration"], + id: Optional[str] = None, + name: Optional[str] = None, + primary: Optional[bool] = None, + enable_accelerated_networking: Optional[bool] = None, + enable_fpga: Optional[bool] = None, + network_security_group: Optional["SubResource"] = None, + dns_settings: Optional["VirtualMachineScaleSetNetworkConfigurationDnsSettings"] = None, + ip_configurations: Optional[List["VirtualMachineScaleSetUpdateIPConfiguration"]] = None, + enable_ip_forwarding: Optional[bool] = None, **kwargs ): - super(LoadBalancerConfigurationProperties, self).__init__(**kwargs) - self.frontend_ip_configurations = frontend_ip_configurations - - -class LoadBalancerFrontendIPConfiguration(msrest.serialization.Model): - """LoadBalancerFrontendIPConfiguration. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the resource that is unique within the set of frontend IP - configurations used by the load balancer. This name can be used to access the resource. - :type name: str - :param properties: Required. Properties of load balancer frontend ip configuration. - :type properties: - ~azure.mgmt.compute.v2021_03_01.models.LoadBalancerFrontendIPConfigurationProperties + super(VirtualMachineScaleSetUpdateNetworkConfiguration, self).__init__(id=id, **kwargs) + self.name = name + self.primary = primary + self.enable_accelerated_networking = enable_accelerated_networking + self.enable_fpga = enable_fpga + self.network_security_group = network_security_group + self.dns_settings = dns_settings + self.ip_configurations = ip_configurations + self.enable_ip_forwarding = enable_ip_forwarding + + +class VirtualMachineScaleSetUpdateNetworkProfile(msrest.serialization.Model): + """Describes a virtual machine scale set network profile. + + :param health_probe: A reference to a load balancer probe used to determine the health of an + instance in the virtual machine scale set. The reference will be in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. + :type health_probe: ~azure.mgmt.compute.v2021_03_01.models.ApiEntityReference + :param network_interface_configurations: The list of network configurations. + :type network_interface_configurations: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetUpdateNetworkConfiguration] """ - _validation = { - 'name': {'required': True}, - 'properties': {'required': True}, - } - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'LoadBalancerFrontendIPConfigurationProperties'}, + 'health_probe': {'key': 'healthProbe', 'type': 'ApiEntityReference'}, + 'network_interface_configurations': {'key': 'networkInterfaceConfigurations', 'type': '[VirtualMachineScaleSetUpdateNetworkConfiguration]'}, } def __init__( self, *, - name: str, - properties: "LoadBalancerFrontendIPConfigurationProperties", + health_probe: Optional["ApiEntityReference"] = None, + network_interface_configurations: Optional[List["VirtualMachineScaleSetUpdateNetworkConfiguration"]] = None, **kwargs ): - super(LoadBalancerFrontendIPConfiguration, self).__init__(**kwargs) - self.name = name - self.properties = properties - + super(VirtualMachineScaleSetUpdateNetworkProfile, self).__init__(**kwargs) + self.health_probe = health_probe + self.network_interface_configurations = network_interface_configurations + + +class VirtualMachineScaleSetUpdateOSDisk(msrest.serialization.Model): + """Describes virtual machine scale set operating system disk Update Object. This should be used for Updating VMSS OS Disk. + + :param caching: The caching type. Possible values include: "None", "ReadOnly", "ReadWrite". + :type caching: str or ~azure.mgmt.compute.v2021_03_01.models.CachingTypes + :param write_accelerator_enabled: Specifies whether writeAccelerator should be enabled or + disabled on the disk. + :type write_accelerator_enabled: bool + :param disk_size_gb: Specifies the size of the operating system disk in gigabytes. This element + can be used to overwrite the size of the disk in a virtual machine image. + :code:`
    `:code:`
    ` This value cannot be larger than 1023 GB. + :type disk_size_gb: int + :param image: The Source User Image VirtualHardDisk. This VirtualHardDisk will be copied before + using it to attach to the Virtual Machine. If SourceImage is provided, the destination + VirtualHardDisk should not exist. + :type image: ~azure.mgmt.compute.v2021_03_01.models.VirtualHardDisk + :param vhd_containers: The list of virtual hard disk container uris. + :type vhd_containers: list[str] + :param managed_disk: The managed disk parameters. + :type managed_disk: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetManagedDiskParameters + """ -class LoadBalancerFrontendIPConfigurationProperties(msrest.serialization.Model): - """Describes a cloud service IP Configuration. + _attribute_map = { + 'caching': {'key': 'caching', 'type': 'str'}, + 'write_accelerator_enabled': {'key': 'writeAcceleratorEnabled', 'type': 'bool'}, + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, + 'image': {'key': 'image', 'type': 'VirtualHardDisk'}, + 'vhd_containers': {'key': 'vhdContainers', 'type': '[str]'}, + 'managed_disk': {'key': 'managedDisk', 'type': 'VirtualMachineScaleSetManagedDiskParameters'}, + } - :param public_ip_address: The reference to the public ip address resource. - :type public_ip_address: ~azure.mgmt.compute.v2021_03_01.models.SubResource - :param subnet: The reference to the virtual network subnet resource. - :type subnet: ~azure.mgmt.compute.v2021_03_01.models.SubResource - :param private_ip_address: The virtual network private IP address of the IP configuration. - :type private_ip_address: str + def __init__( + self, + *, + caching: Optional[Union[str, "CachingTypes"]] = None, + write_accelerator_enabled: Optional[bool] = None, + disk_size_gb: Optional[int] = None, + image: Optional["VirtualHardDisk"] = None, + vhd_containers: Optional[List[str]] = None, + managed_disk: Optional["VirtualMachineScaleSetManagedDiskParameters"] = None, + **kwargs + ): + super(VirtualMachineScaleSetUpdateOSDisk, self).__init__(**kwargs) + self.caching = caching + self.write_accelerator_enabled = write_accelerator_enabled + self.disk_size_gb = disk_size_gb + self.image = image + self.vhd_containers = vhd_containers + self.managed_disk = managed_disk + + +class VirtualMachineScaleSetUpdateOSProfile(msrest.serialization.Model): + """Describes a virtual machine scale set OS profile. + + :param custom_data: A base-64 encoded string of custom data. + :type custom_data: str + :param windows_configuration: The Windows Configuration of the OS profile. + :type windows_configuration: ~azure.mgmt.compute.v2021_03_01.models.WindowsConfiguration + :param linux_configuration: The Linux Configuration of the OS profile. + :type linux_configuration: ~azure.mgmt.compute.v2021_03_01.models.LinuxConfiguration + :param secrets: The List of certificates for addition to the VM. + :type secrets: list[~azure.mgmt.compute.v2021_03_01.models.VaultSecretGroup] """ _attribute_map = { - 'public_ip_address': {'key': 'publicIPAddress', 'type': 'SubResource'}, - 'subnet': {'key': 'subnet', 'type': 'SubResource'}, - 'private_ip_address': {'key': 'privateIPAddress', 'type': 'str'}, + 'custom_data': {'key': 'customData', 'type': 'str'}, + 'windows_configuration': {'key': 'windowsConfiguration', 'type': 'WindowsConfiguration'}, + 'linux_configuration': {'key': 'linuxConfiguration', 'type': 'LinuxConfiguration'}, + 'secrets': {'key': 'secrets', 'type': '[VaultSecretGroup]'}, } def __init__( self, *, - public_ip_address: Optional["SubResource"] = None, - subnet: Optional["SubResource"] = None, - private_ip_address: Optional[str] = None, + custom_data: Optional[str] = None, + windows_configuration: Optional["WindowsConfiguration"] = None, + linux_configuration: Optional["LinuxConfiguration"] = None, + secrets: Optional[List["VaultSecretGroup"]] = None, **kwargs ): - super(LoadBalancerFrontendIPConfigurationProperties, self).__init__(**kwargs) - self.public_ip_address = public_ip_address - self.subnet = subnet - self.private_ip_address = private_ip_address - + super(VirtualMachineScaleSetUpdateOSProfile, self).__init__(**kwargs) + self.custom_data = custom_data + self.windows_configuration = windows_configuration + self.linux_configuration = linux_configuration + self.secrets = secrets -class OSFamily(msrest.serialization.Model): - """Describes a cloud service OS family. - Variables are only populated by the server, and will be ignored when sending a request. +class VirtualMachineScaleSetUpdatePublicIPAddressConfiguration(msrest.serialization.Model): + """Describes a virtual machines scale set IP Configuration's PublicIPAddress configuration. - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar location: Resource location. - :vartype location: str - :param properties: OS family properties. - :type properties: ~azure.mgmt.compute.v2021_03_01.models.OSFamilyProperties + :param name: The publicIP address configuration name. + :type name: str + :param idle_timeout_in_minutes: The idle timeout of the public IP address. + :type idle_timeout_in_minutes: int + :param dns_settings: The dns settings to be applied on the publicIP addresses . + :type dns_settings: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings """ - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - } - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'OSFamilyProperties'}, + 'name': {'key': 'name', 'type': 'str'}, + 'idle_timeout_in_minutes': {'key': 'properties.idleTimeoutInMinutes', 'type': 'int'}, + 'dns_settings': {'key': 'properties.dnsSettings', 'type': 'VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings'}, } def __init__( self, *, - properties: Optional["OSFamilyProperties"] = None, + name: Optional[str] = None, + idle_timeout_in_minutes: Optional[int] = None, + dns_settings: Optional["VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings"] = None, **kwargs ): - super(OSFamily, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = None - self.properties = properties - + super(VirtualMachineScaleSetUpdatePublicIPAddressConfiguration, self).__init__(**kwargs) + self.name = name + self.idle_timeout_in_minutes = idle_timeout_in_minutes + self.dns_settings = dns_settings -class OSFamilyListResult(msrest.serialization.Model): - """OSFamilyListResult. - All required parameters must be populated in order to send to Azure. +class VirtualMachineScaleSetUpdateStorageProfile(msrest.serialization.Model): + """Describes a virtual machine scale set storage profile. - :param value: Required. - :type value: list[~azure.mgmt.compute.v2021_03_01.models.OSFamily] - :param next_link: - :type next_link: str + :param image_reference: The image reference. + :type image_reference: ~azure.mgmt.compute.v2021_03_01.models.ImageReference + :param os_disk: The OS disk. + :type os_disk: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetUpdateOSDisk + :param data_disks: The data disks. + :type data_disks: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetDataDisk] """ - _validation = { - 'value': {'required': True}, + _attribute_map = { + 'image_reference': {'key': 'imageReference', 'type': 'ImageReference'}, + 'os_disk': {'key': 'osDisk', 'type': 'VirtualMachineScaleSetUpdateOSDisk'}, + 'data_disks': {'key': 'dataDisks', 'type': '[VirtualMachineScaleSetDataDisk]'}, } + def __init__( + self, + *, + image_reference: Optional["ImageReference"] = None, + os_disk: Optional["VirtualMachineScaleSetUpdateOSDisk"] = None, + data_disks: Optional[List["VirtualMachineScaleSetDataDisk"]] = None, + **kwargs + ): + super(VirtualMachineScaleSetUpdateStorageProfile, self).__init__(**kwargs) + self.image_reference = image_reference + self.os_disk = os_disk + self.data_disks = data_disks + + +class VirtualMachineScaleSetUpdateVMProfile(msrest.serialization.Model): + """Describes a virtual machine scale set virtual machine profile. + + :param os_profile: The virtual machine scale set OS profile. + :type os_profile: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetUpdateOSProfile + :param storage_profile: The virtual machine scale set storage profile. + :type storage_profile: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetUpdateStorageProfile + :param network_profile: The virtual machine scale set network profile. + :type network_profile: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetUpdateNetworkProfile + :param security_profile: The virtual machine scale set Security profile. + :type security_profile: ~azure.mgmt.compute.v2021_03_01.models.SecurityProfile + :param diagnostics_profile: The virtual machine scale set diagnostics profile. + :type diagnostics_profile: ~azure.mgmt.compute.v2021_03_01.models.DiagnosticsProfile + :param extension_profile: The virtual machine scale set extension profile. + :type extension_profile: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetExtensionProfile + :param license_type: The license type, which is for bring your own license scenario. + :type license_type: str + :param billing_profile: Specifies the billing related details of a Azure Spot VMSS. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :type billing_profile: ~azure.mgmt.compute.v2021_03_01.models.BillingProfile + :param scheduled_events_profile: Specifies Scheduled Event related configurations. + :type scheduled_events_profile: ~azure.mgmt.compute.v2021_03_01.models.ScheduledEventsProfile + :param user_data: UserData for the VM, which must be base-64 encoded. Customer should not pass + any secrets in here. :code:`
    `:code:`
    `Minimum api-version: 2021-03-01. + :type user_data: str + """ + _attribute_map = { - 'value': {'key': 'value', 'type': '[OSFamily]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'os_profile': {'key': 'osProfile', 'type': 'VirtualMachineScaleSetUpdateOSProfile'}, + 'storage_profile': {'key': 'storageProfile', 'type': 'VirtualMachineScaleSetUpdateStorageProfile'}, + 'network_profile': {'key': 'networkProfile', 'type': 'VirtualMachineScaleSetUpdateNetworkProfile'}, + 'security_profile': {'key': 'securityProfile', 'type': 'SecurityProfile'}, + 'diagnostics_profile': {'key': 'diagnosticsProfile', 'type': 'DiagnosticsProfile'}, + 'extension_profile': {'key': 'extensionProfile', 'type': 'VirtualMachineScaleSetExtensionProfile'}, + 'license_type': {'key': 'licenseType', 'type': 'str'}, + 'billing_profile': {'key': 'billingProfile', 'type': 'BillingProfile'}, + 'scheduled_events_profile': {'key': 'scheduledEventsProfile', 'type': 'ScheduledEventsProfile'}, + 'user_data': {'key': 'userData', 'type': 'str'}, } def __init__( self, *, - value: List["OSFamily"], - next_link: Optional[str] = None, + os_profile: Optional["VirtualMachineScaleSetUpdateOSProfile"] = None, + storage_profile: Optional["VirtualMachineScaleSetUpdateStorageProfile"] = None, + network_profile: Optional["VirtualMachineScaleSetUpdateNetworkProfile"] = None, + security_profile: Optional["SecurityProfile"] = None, + diagnostics_profile: Optional["DiagnosticsProfile"] = None, + extension_profile: Optional["VirtualMachineScaleSetExtensionProfile"] = None, + license_type: Optional[str] = None, + billing_profile: Optional["BillingProfile"] = None, + scheduled_events_profile: Optional["ScheduledEventsProfile"] = None, + user_data: Optional[str] = None, **kwargs ): - super(OSFamilyListResult, self).__init__(**kwargs) - self.value = value - self.next_link = next_link + super(VirtualMachineScaleSetUpdateVMProfile, self).__init__(**kwargs) + self.os_profile = os_profile + self.storage_profile = storage_profile + self.network_profile = network_profile + self.security_profile = security_profile + self.diagnostics_profile = diagnostics_profile + self.extension_profile = extension_profile + self.license_type = license_type + self.billing_profile = billing_profile + self.scheduled_events_profile = scheduled_events_profile + self.user_data = user_data -class OSFamilyProperties(msrest.serialization.Model): - """OS family properties. +class VirtualMachineScaleSetVM(Resource): + """Describes a virtual machine scale set virtual machine. Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: The OS family name. + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. :vartype name: str - :ivar label: The OS family label. - :vartype label: str - :ivar versions: List of OS versions belonging to this family. - :vartype versions: list[~azure.mgmt.compute.v2021_03_01.models.OSVersionPropertiesBase] + :ivar type: Resource type. + :vartype type: str + :param location: Required. Resource location. + :type location: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :ivar instance_id: The virtual machine instance ID. + :vartype instance_id: str + :ivar sku: The virtual machine SKU. + :vartype sku: ~azure.mgmt.compute.v2021_03_01.models.Sku + :param plan: Specifies information about the marketplace image used to create the virtual + machine. This element is only used for marketplace images. Before you can use a marketplace + image from an API, you must enable the image for programmatic use. In the Azure portal, find + the marketplace image that you want to use and then click **Want to deploy programmatically, + Get Started ->**. Enter any required information and then click **Save**. + :type plan: ~azure.mgmt.compute.v2021_03_01.models.Plan + :ivar resources: The virtual machine child extension resources. + :vartype resources: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtension] + :ivar zones: The virtual machine zones. + :vartype zones: list[str] + :ivar latest_model_applied: Specifies whether the latest model has been applied to the virtual + machine. + :vartype latest_model_applied: bool + :ivar vm_id: Azure VM unique ID. + :vartype vm_id: str + :ivar instance_view: The virtual machine instance view. + :vartype instance_view: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMInstanceView + :param hardware_profile: Specifies the hardware settings for the virtual machine. + :type hardware_profile: ~azure.mgmt.compute.v2021_03_01.models.HardwareProfile + :param storage_profile: Specifies the storage settings for the virtual machine disks. + :type storage_profile: ~azure.mgmt.compute.v2021_03_01.models.StorageProfile + :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + virtual machine in the scale set. For instance: whether the virtual machine has the capability + to support attaching managed data disks with UltraSSD_LRS storage account type. + :type additional_capabilities: ~azure.mgmt.compute.v2021_03_01.models.AdditionalCapabilities + :param os_profile: Specifies the operating system settings for the virtual machine. + :type os_profile: ~azure.mgmt.compute.v2021_03_01.models.OSProfile + :param security_profile: Specifies the Security related profile settings for the virtual + machine. + :type security_profile: ~azure.mgmt.compute.v2021_03_01.models.SecurityProfile + :param network_profile: Specifies the network interfaces of the virtual machine. + :type network_profile: ~azure.mgmt.compute.v2021_03_01.models.NetworkProfile + :param network_profile_configuration: Specifies the network profile configuration of the + virtual machine. + :type network_profile_configuration: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMNetworkProfileConfiguration + :param diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :type diagnostics_profile: ~azure.mgmt.compute.v2021_03_01.models.DiagnosticsProfile + :param availability_set: Specifies information about the availability set that the virtual + machine should be assigned to. Virtual machines specified in the same availability set are + allocated to different nodes to maximize availability. For more information about availability + sets, see `Manage the availability of virtual machines + `_. :code:`
    `:code:`
    ` + For more information on Azure planned maintenance, see `Planned maintenance for virtual + machines in Azure `_ + :code:`
    `:code:`
    ` Currently, a VM can only be added to availability set at creation + time. An existing VM cannot be added to an availability set. + :type availability_set: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :param license_type: Specifies that the image or disk that is being used was licensed on- + premises. :code:`
    `:code:`
    ` Possible values for Windows Server operating system are: + :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server + :code:`
    `:code:`
    ` Possible values for Linux Server operating system are: + :code:`
    `:code:`
    ` RHEL_BYOS (for RHEL) :code:`
    `:code:`
    ` SLES_BYOS (for SUSE) + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` `Azure Hybrid Use Benefit for Linux Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :type license_type: str + :ivar model_definition_applied: Specifies whether the model applied to the virtual machine is + the model of the virtual machine scale set or the customized model for the virtual machine. + :vartype model_definition_applied: str + :param protection_policy: Specifies the protection policy of the virtual machine. + :type protection_policy: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMProtectionPolicy + :param user_data: UserData for the VM, which must be base-64 encoded. Customer should not pass + any secrets in here. :code:`
    `:code:`
    `Minimum api-version: 2021-03-01. + :type user_data: str """ _validation = { + 'id': {'readonly': True}, 'name': {'readonly': True}, - 'label': {'readonly': True}, - 'versions': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'instance_id': {'readonly': True}, + 'sku': {'readonly': True}, + 'resources': {'readonly': True}, + 'zones': {'readonly': True}, + 'latest_model_applied': {'readonly': True}, + 'vm_id': {'readonly': True}, + 'instance_view': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'model_definition_applied': {'readonly': True}, } _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'versions': {'key': 'versions', 'type': '[OSVersionPropertiesBase]'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'instance_id': {'key': 'instanceId', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'plan': {'key': 'plan', 'type': 'Plan'}, + 'resources': {'key': 'resources', 'type': '[VirtualMachineExtension]'}, + 'zones': {'key': 'zones', 'type': '[str]'}, + 'latest_model_applied': {'key': 'properties.latestModelApplied', 'type': 'bool'}, + 'vm_id': {'key': 'properties.vmId', 'type': 'str'}, + 'instance_view': {'key': 'properties.instanceView', 'type': 'VirtualMachineScaleSetVMInstanceView'}, + 'hardware_profile': {'key': 'properties.hardwareProfile', 'type': 'HardwareProfile'}, + 'storage_profile': {'key': 'properties.storageProfile', 'type': 'StorageProfile'}, + 'additional_capabilities': {'key': 'properties.additionalCapabilities', 'type': 'AdditionalCapabilities'}, + 'os_profile': {'key': 'properties.osProfile', 'type': 'OSProfile'}, + 'security_profile': {'key': 'properties.securityProfile', 'type': 'SecurityProfile'}, + 'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'}, + 'network_profile_configuration': {'key': 'properties.networkProfileConfiguration', 'type': 'VirtualMachineScaleSetVMNetworkProfileConfiguration'}, + 'diagnostics_profile': {'key': 'properties.diagnosticsProfile', 'type': 'DiagnosticsProfile'}, + 'availability_set': {'key': 'properties.availabilitySet', 'type': 'SubResource'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'license_type': {'key': 'properties.licenseType', 'type': 'str'}, + 'model_definition_applied': {'key': 'properties.modelDefinitionApplied', 'type': 'str'}, + 'protection_policy': {'key': 'properties.protectionPolicy', 'type': 'VirtualMachineScaleSetVMProtectionPolicy'}, + 'user_data': {'key': 'properties.userData', 'type': 'str'}, } def __init__( self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + plan: Optional["Plan"] = None, + hardware_profile: Optional["HardwareProfile"] = None, + storage_profile: Optional["StorageProfile"] = None, + additional_capabilities: Optional["AdditionalCapabilities"] = None, + os_profile: Optional["OSProfile"] = None, + security_profile: Optional["SecurityProfile"] = None, + network_profile: Optional["NetworkProfile"] = None, + network_profile_configuration: Optional["VirtualMachineScaleSetVMNetworkProfileConfiguration"] = None, + diagnostics_profile: Optional["DiagnosticsProfile"] = None, + availability_set: Optional["SubResource"] = None, + license_type: Optional[str] = None, + protection_policy: Optional["VirtualMachineScaleSetVMProtectionPolicy"] = None, + user_data: Optional[str] = None, **kwargs ): - super(OSFamilyProperties, self).__init__(**kwargs) - self.name = None - self.label = None - self.versions = None + super(VirtualMachineScaleSetVM, self).__init__(location=location, tags=tags, **kwargs) + self.instance_id = None + self.sku = None + self.plan = plan + self.resources = None + self.zones = None + self.latest_model_applied = None + self.vm_id = None + self.instance_view = None + self.hardware_profile = hardware_profile + self.storage_profile = storage_profile + self.additional_capabilities = additional_capabilities + self.os_profile = os_profile + self.security_profile = security_profile + self.network_profile = network_profile + self.network_profile_configuration = network_profile_configuration + self.diagnostics_profile = diagnostics_profile + self.availability_set = availability_set + self.provisioning_state = None + self.license_type = license_type + self.model_definition_applied = None + self.protection_policy = protection_policy + self.user_data = user_data -class OSVersion(msrest.serialization.Model): - """Describes a cloud service OS version. +class VirtualMachineScaleSetVMExtension(SubResourceReadOnly): + """Describes a VMSS VM Extension. Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource Id. :vartype id: str - :ivar name: Resource name. + :ivar name: The name of the extension. :vartype name: str :ivar type: Resource type. :vartype type: str - :ivar location: Resource location. - :vartype location: str - :param properties: OS version properties. - :type properties: ~azure.mgmt.compute.v2021_03_01.models.OSVersionProperties + :param force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :type force_update_tag: str + :param publisher: The name of the extension handler publisher. + :type publisher: str + :param type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :type type_properties_type: str + :param type_handler_version: Specifies the version of the script handler. + :type type_handler_version: str + :param 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. + :type auto_upgrade_minor_version: bool + :param enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :type enable_automatic_upgrade: bool + :param settings: Json formatted public settings for the extension. + :type settings: object + :param protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :type protected_settings: object + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :param instance_view: The virtual machine extension instance view. + :type instance_view: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtensionInstanceView """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'location': {'readonly': True}, + 'provisioning_state': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'OSVersionProperties'}, + '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'}, + 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, + 'enable_automatic_upgrade': {'key': 'properties.enableAutomaticUpgrade', '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': 'VirtualMachineExtensionInstanceView'}, } def __init__( self, *, - properties: Optional["OSVersionProperties"] = None, + force_update_tag: Optional[str] = None, + publisher: Optional[str] = None, + type_properties_type: Optional[str] = None, + type_handler_version: Optional[str] = None, + auto_upgrade_minor_version: Optional[bool] = None, + enable_automatic_upgrade: Optional[bool] = None, + settings: Optional[object] = None, + protected_settings: Optional[object] = None, + instance_view: Optional["VirtualMachineExtensionInstanceView"] = None, **kwargs ): - super(OSVersion, self).__init__(**kwargs) - self.id = None + super(VirtualMachineScaleSetVMExtension, self).__init__(**kwargs) self.name = None self.type = None - self.location = None - self.properties = properties - + 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.auto_upgrade_minor_version = auto_upgrade_minor_version + self.enable_automatic_upgrade = enable_automatic_upgrade + self.settings = settings + self.protected_settings = protected_settings + self.provisioning_state = None + self.instance_view = instance_view -class OSVersionListResult(msrest.serialization.Model): - """OSVersionListResult. - All required parameters must be populated in order to send to Azure. +class VirtualMachineScaleSetVMExtensionsListResult(msrest.serialization.Model): + """The List VMSS VM Extension operation response. - :param value: Required. - :type value: list[~azure.mgmt.compute.v2021_03_01.models.OSVersion] - :param next_link: - :type next_link: str + :param value: The list of VMSS VM extensions. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMExtension] """ - _validation = { - 'value': {'required': True}, - } - _attribute_map = { - 'value': {'key': 'value', 'type': '[OSVersion]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[VirtualMachineScaleSetVMExtension]'}, } def __init__( self, *, - value: List["OSVersion"], - next_link: Optional[str] = None, + value: Optional[List["VirtualMachineScaleSetVMExtension"]] = None, **kwargs ): - super(OSVersionListResult, self).__init__(**kwargs) + super(VirtualMachineScaleSetVMExtensionsListResult, self).__init__(**kwargs) self.value = value - self.next_link = next_link -class OSVersionProperties(msrest.serialization.Model): - """OS version properties. +class VirtualMachineScaleSetVMExtensionsSummary(msrest.serialization.Model): + """Extensions summary for virtual machines of a virtual machine scale set. Variables are only populated by the server, and will be ignored when sending a request. - :ivar family: The family of this OS version. - :vartype family: str - :ivar family_label: The family label of this OS version. - :vartype family_label: str - :ivar version: The OS version. - :vartype version: str - :ivar label: The OS version label. - :vartype label: str - :ivar is_default: Specifies whether this is the default OS version for its family. - :vartype is_default: bool - :ivar is_active: Specifies whether this OS version is active. - :vartype is_active: bool + :ivar name: The extension name. + :vartype name: str + :ivar statuses_summary: The extensions information. + :vartype statuses_summary: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineStatusCodeCount] """ _validation = { - 'family': {'readonly': True}, - 'family_label': {'readonly': True}, - 'version': {'readonly': True}, - 'label': {'readonly': True}, - 'is_default': {'readonly': True}, - 'is_active': {'readonly': True}, + 'name': {'readonly': True}, + 'statuses_summary': {'readonly': True}, } _attribute_map = { - 'family': {'key': 'family', 'type': 'str'}, - 'family_label': {'key': 'familyLabel', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'is_default': {'key': 'isDefault', 'type': 'bool'}, - 'is_active': {'key': 'isActive', 'type': 'bool'}, + 'name': {'key': 'name', 'type': 'str'}, + 'statuses_summary': {'key': 'statusesSummary', 'type': '[VirtualMachineStatusCodeCount]'}, } def __init__( self, **kwargs ): - super(OSVersionProperties, self).__init__(**kwargs) - self.family = None - self.family_label = None - self.version = None - self.label = None - self.is_default = None - self.is_active = None + super(VirtualMachineScaleSetVMExtensionsSummary, self).__init__(**kwargs) + self.name = None + self.statuses_summary = None -class OSVersionPropertiesBase(msrest.serialization.Model): - """Configuration view of an OS version. +class VirtualMachineScaleSetVMExtensionUpdate(SubResourceReadOnly): + """Describes a VMSS VM Extension. Variables are only populated by the server, and will be ignored when sending a request. - :ivar version: The OS version. - :vartype version: str - :ivar label: The OS version label. - :vartype label: str - :ivar is_default: Specifies whether this is the default OS version for its family. - :vartype is_default: bool - :ivar is_active: Specifies whether this OS version is active. - :vartype is_active: bool + :ivar id: Resource Id. + :vartype id: str + :ivar name: The name of the extension. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :param force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :type force_update_tag: str + :param publisher: The name of the extension handler publisher. + :type publisher: str + :param type_properties_type: Specifies the type of the extension; an example is + "CustomScriptExtension". + :type type_properties_type: str + :param type_handler_version: Specifies the version of the script handler. + :type type_handler_version: str + :param 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. + :type auto_upgrade_minor_version: bool + :param enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :type enable_automatic_upgrade: bool + :param settings: Json formatted public settings for the extension. + :type settings: object + :param protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :type protected_settings: object """ _validation = { - 'version': {'readonly': True}, - 'label': {'readonly': True}, - 'is_default': {'readonly': True}, - 'is_active': {'readonly': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, } _attribute_map = { - 'version': {'key': 'version', 'type': 'str'}, - 'label': {'key': 'label', 'type': 'str'}, - 'is_default': {'key': 'isDefault', 'type': 'bool'}, - 'is_active': {'key': 'isActive', 'type': 'bool'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', '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'}, + 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, + 'enable_automatic_upgrade': {'key': 'properties.enableAutomaticUpgrade', 'type': 'bool'}, + 'settings': {'key': 'properties.settings', 'type': 'object'}, + 'protected_settings': {'key': 'properties.protectedSettings', 'type': 'object'}, } def __init__( self, + *, + force_update_tag: Optional[str] = None, + publisher: Optional[str] = None, + type_properties_type: Optional[str] = None, + type_handler_version: Optional[str] = None, + auto_upgrade_minor_version: Optional[bool] = None, + enable_automatic_upgrade: Optional[bool] = None, + settings: Optional[object] = None, + protected_settings: Optional[object] = None, **kwargs ): - super(OSVersionPropertiesBase, self).__init__(**kwargs) - self.version = None - self.label = None - self.is_default = None - self.is_active = None - + super(VirtualMachineScaleSetVMExtensionUpdate, self).__init__(**kwargs) + self.name = 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.auto_upgrade_minor_version = auto_upgrade_minor_version + self.enable_automatic_upgrade = enable_automatic_upgrade + self.settings = settings + self.protected_settings = protected_settings -class ResourceInstanceViewStatus(msrest.serialization.Model): - """Instance view status. - Variables are only populated by the server, and will be ignored when sending a request. +class VirtualMachineScaleSetVMInstanceIDs(msrest.serialization.Model): + """Specifies a list of virtual machine instance IDs from the VM scale set. - :ivar code: The status code. - :vartype code: str - :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 - :param level: The level code. Possible values include: "Info", "Warning", "Error". - :type level: str or ~azure.mgmt.compute.v2021_03_01.models.StatusLevelTypes + :param instance_ids: The virtual machine scale set instance ids. Omitting the virtual machine + scale set instance ids will result in the operation being performed on all virtual machines in + the virtual machine scale set. + :type instance_ids: list[str] """ - _validation = { - 'code': {'readonly': True}, - 'display_status': {'readonly': True}, - 'message': {'readonly': True}, - 'time': {'readonly': True}, + _attribute_map = { + 'instance_ids': {'key': 'instanceIds', 'type': '[str]'}, + } + + def __init__( + self, + *, + instance_ids: Optional[List[str]] = None, + **kwargs + ): + super(VirtualMachineScaleSetVMInstanceIDs, self).__init__(**kwargs) + self.instance_ids = instance_ids + + +class VirtualMachineScaleSetVMInstanceRequiredIDs(msrest.serialization.Model): + """Specifies a list of virtual machine instance IDs from the VM scale set. + + All required parameters must be populated in order to send to Azure. + + :param instance_ids: Required. The virtual machine scale set instance ids. + :type instance_ids: list[str] + """ + + _validation = { + 'instance_ids': {'required': True}, } _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'display_status': {'key': 'displayStatus', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'time': {'key': 'time', 'type': 'iso-8601'}, - 'level': {'key': 'level', 'type': 'str'}, + 'instance_ids': {'key': 'instanceIds', 'type': '[str]'}, } def __init__( self, *, - level: Optional[Union[str, "StatusLevelTypes"]] = None, + instance_ids: List[str], **kwargs ): - super(ResourceInstanceViewStatus, self).__init__(**kwargs) - self.code = None - self.display_status = None - self.message = None - self.time = None - self.level = level + super(VirtualMachineScaleSetVMInstanceRequiredIDs, self).__init__(**kwargs) + self.instance_ids = instance_ids -class RoleInstance(msrest.serialization.Model): - """RoleInstance. +class VirtualMachineScaleSetVMInstanceView(msrest.serialization.Model): + """The instance view of a virtual machine scale set VM. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str - :ivar type: Resource Type. - :vartype type: str - :ivar location: Resource Location. - :vartype location: str - :ivar tags: A set of tags. Resource tags. - :vartype tags: dict[str, str] - :param sku: - :type sku: ~azure.mgmt.compute.v2021_03_01.models.InstanceSku - :param properties: - :type properties: ~azure.mgmt.compute.v2021_03_01.models.RoleInstanceProperties + :param platform_update_domain: The Update Domain count. + :type platform_update_domain: int + :param platform_fault_domain: The Fault Domain count. + :type platform_fault_domain: int + :param rdp_thumb_print: The Remote desktop certificate thumbprint. + :type rdp_thumb_print: str + :param vm_agent: The VM Agent running on the virtual machine. + :type vm_agent: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineAgentInstanceView + :param maintenance_redeploy_status: The Maintenance Operation status on the virtual machine. + :type maintenance_redeploy_status: + ~azure.mgmt.compute.v2021_03_01.models.MaintenanceRedeployStatus + :param disks: The disks information. + :type disks: list[~azure.mgmt.compute.v2021_03_01.models.DiskInstanceView] + :param extensions: The extensions information. + :type extensions: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtensionInstanceView] + :ivar vm_health: The health status for the VM. + :vartype vm_health: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineHealthStatus + :param boot_diagnostics: Boot Diagnostics is a debugging feature which allows you to view + Console Output and Screenshot to diagnose VM status. :code:`
    `:code:`
    ` You can easily + view the output of your console log. :code:`
    `:code:`
    ` Azure also enables you to see a + screenshot of the VM from the hypervisor. + :type boot_diagnostics: ~azure.mgmt.compute.v2021_03_01.models.BootDiagnosticsInstanceView + :param statuses: The resource status information. + :type statuses: list[~azure.mgmt.compute.v2021_03_01.models.InstanceViewStatus] + :ivar assigned_host: Resource id of the dedicated host, on which the virtual machine is + allocated through automatic placement, when the virtual machine is associated with a dedicated + host group that has automatic placement enabled. :code:`
    `:code:`
    `Minimum api-version: + 2020-06-01. + :vartype assigned_host: str + :param placement_group_id: The placement group in which the VM is running. If the VM is + deallocated it will not have a placementGroupId. + :type placement_group_id: str """ _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'tags': {'readonly': True}, + 'vm_health': {'readonly': True}, + 'assigned_host': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'InstanceSku'}, - 'properties': {'key': 'properties', 'type': 'RoleInstanceProperties'}, + 'platform_update_domain': {'key': 'platformUpdateDomain', 'type': 'int'}, + 'platform_fault_domain': {'key': 'platformFaultDomain', 'type': 'int'}, + 'rdp_thumb_print': {'key': 'rdpThumbPrint', 'type': 'str'}, + 'vm_agent': {'key': 'vmAgent', 'type': 'VirtualMachineAgentInstanceView'}, + 'maintenance_redeploy_status': {'key': 'maintenanceRedeployStatus', 'type': 'MaintenanceRedeployStatus'}, + 'disks': {'key': 'disks', 'type': '[DiskInstanceView]'}, + 'extensions': {'key': 'extensions', 'type': '[VirtualMachineExtensionInstanceView]'}, + 'vm_health': {'key': 'vmHealth', 'type': 'VirtualMachineHealthStatus'}, + 'boot_diagnostics': {'key': 'bootDiagnostics', 'type': 'BootDiagnosticsInstanceView'}, + 'statuses': {'key': 'statuses', 'type': '[InstanceViewStatus]'}, + 'assigned_host': {'key': 'assignedHost', 'type': 'str'}, + 'placement_group_id': {'key': 'placementGroupId', 'type': 'str'}, } def __init__( self, *, - sku: Optional["InstanceSku"] = None, - properties: Optional["RoleInstanceProperties"] = None, + platform_update_domain: Optional[int] = None, + platform_fault_domain: Optional[int] = None, + rdp_thumb_print: Optional[str] = None, + vm_agent: Optional["VirtualMachineAgentInstanceView"] = None, + maintenance_redeploy_status: Optional["MaintenanceRedeployStatus"] = None, + disks: Optional[List["DiskInstanceView"]] = None, + extensions: Optional[List["VirtualMachineExtensionInstanceView"]] = None, + boot_diagnostics: Optional["BootDiagnosticsInstanceView"] = None, + statuses: Optional[List["InstanceViewStatus"]] = None, + placement_group_id: Optional[str] = None, **kwargs ): - super(RoleInstance, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = None - self.tags = None - self.sku = sku - self.properties = properties + super(VirtualMachineScaleSetVMInstanceView, self).__init__(**kwargs) + self.platform_update_domain = platform_update_domain + self.platform_fault_domain = platform_fault_domain + self.rdp_thumb_print = rdp_thumb_print + self.vm_agent = vm_agent + self.maintenance_redeploy_status = maintenance_redeploy_status + self.disks = disks + self.extensions = extensions + self.vm_health = None + self.boot_diagnostics = boot_diagnostics + self.statuses = statuses + self.assigned_host = None + self.placement_group_id = placement_group_id -class RoleInstanceListResult(msrest.serialization.Model): - """RoleInstanceListResult. +class VirtualMachineScaleSetVMListResult(msrest.serialization.Model): + """The List Virtual Machine Scale Set VMs operation response. All required parameters must be populated in order to send to Azure. - :param value: Required. - :type value: list[~azure.mgmt.compute.v2021_03_01.models.RoleInstance] - :param next_link: + :param value: Required. The list of virtual machine scale sets VMs. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVM] + :param next_link: The uri to fetch the next page of Virtual Machine Scale Set VMs. Call + ListNext() with this to fetch the next page of VMSS VMs. :type next_link: str """ @@ -1407,152 +10612,327 @@ class RoleInstanceListResult(msrest.serialization.Model): } _attribute_map = { - 'value': {'key': 'value', 'type': '[RoleInstance]'}, + 'value': {'key': 'value', 'type': '[VirtualMachineScaleSetVM]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } def __init__( self, *, - value: List["RoleInstance"], + value: List["VirtualMachineScaleSetVM"], next_link: Optional[str] = None, **kwargs ): - super(RoleInstanceListResult, self).__init__(**kwargs) + super(VirtualMachineScaleSetVMListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link -class RoleInstanceNetworkProfile(msrest.serialization.Model): - """Describes the network profile for the role instance. +class VirtualMachineScaleSetVMNetworkProfileConfiguration(msrest.serialization.Model): + """Describes a virtual machine scale set VM network profile. - Variables are only populated by the server, and will be ignored when sending a request. + :param network_interface_configurations: The list of network configurations. + :type network_interface_configurations: + list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetNetworkConfiguration] + """ - :ivar network_interfaces: Specifies the list of resource Ids for the network interfaces - associated with the role instance. - :vartype network_interfaces: list[~azure.mgmt.compute.v2021_03_01.models.SubResource] + _attribute_map = { + 'network_interface_configurations': {'key': 'networkInterfaceConfigurations', 'type': '[VirtualMachineScaleSetNetworkConfiguration]'}, + } + + def __init__( + self, + *, + network_interface_configurations: Optional[List["VirtualMachineScaleSetNetworkConfiguration"]] = None, + **kwargs + ): + super(VirtualMachineScaleSetVMNetworkProfileConfiguration, self).__init__(**kwargs) + self.network_interface_configurations = network_interface_configurations + + +class VirtualMachineScaleSetVMProfile(msrest.serialization.Model): + """Describes a virtual machine scale set virtual machine profile. + + :param os_profile: Specifies the operating system settings for the virtual machines in the + scale set. + :type os_profile: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetOSProfile + :param storage_profile: Specifies the storage settings for the virtual machine disks. + :type storage_profile: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetStorageProfile + :param network_profile: Specifies properties of the network interfaces of the virtual machines + in the scale set. + :type network_profile: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetNetworkProfile + :param security_profile: Specifies the Security related profile settings for the virtual + machines in the scale set. + :type security_profile: ~azure.mgmt.compute.v2021_03_01.models.SecurityProfile + :param diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :type diagnostics_profile: ~azure.mgmt.compute.v2021_03_01.models.DiagnosticsProfile + :param extension_profile: Specifies a collection of settings for extensions installed on + virtual machines in the scale set. + :type extension_profile: + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetExtensionProfile + :param license_type: Specifies that the image or disk that is being used was licensed on- + premises. :code:`
    `:code:`
    ` Possible values for Windows Server operating system are: + :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server + :code:`
    `:code:`
    ` Possible values for Linux Server operating system are: + :code:`
    `:code:`
    ` RHEL_BYOS (for RHEL) :code:`
    `:code:`
    ` SLES_BYOS (for SUSE) + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` `Azure Hybrid Use Benefit for Linux Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :type license_type: str + :param priority: Specifies the priority for the virtual machines in the scale set. + :code:`
    `:code:`
    `Minimum api-version: 2017-10-30-preview. Possible values include: + "Regular", "Low", "Spot". + :type priority: str or ~azure.mgmt.compute.v2021_03_01.models.VirtualMachinePriorityTypes + :param eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and + Azure Spot scale set. :code:`
    `:code:`
    `For Azure Spot virtual machines, both + 'Deallocate' and 'Delete' are supported and the minimum api-version is 2019-03-01. + :code:`
    `:code:`
    `For Azure Spot scale sets, both 'Deallocate' and 'Delete' are supported + and the minimum api-version is 2017-10-30-preview. Possible values include: "Deallocate", + "Delete". + :type eviction_policy: str or + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineEvictionPolicyTypes + :param billing_profile: Specifies the billing related details of a Azure Spot VMSS. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :type billing_profile: ~azure.mgmt.compute.v2021_03_01.models.BillingProfile + :param scheduled_events_profile: Specifies Scheduled Event related configurations. + :type scheduled_events_profile: ~azure.mgmt.compute.v2021_03_01.models.ScheduledEventsProfile + :param user_data: UserData for the VMSS, which must be base-64 encoded. Customer should not + pass any secrets in here. :code:`
    `:code:`
    `Minimum api-version: 2021-03-01. + :type user_data: str """ - _validation = { - 'network_interfaces': {'readonly': True}, + _attribute_map = { + 'os_profile': {'key': 'osProfile', 'type': 'VirtualMachineScaleSetOSProfile'}, + 'storage_profile': {'key': 'storageProfile', 'type': 'VirtualMachineScaleSetStorageProfile'}, + 'network_profile': {'key': 'networkProfile', 'type': 'VirtualMachineScaleSetNetworkProfile'}, + 'security_profile': {'key': 'securityProfile', 'type': 'SecurityProfile'}, + 'diagnostics_profile': {'key': 'diagnosticsProfile', 'type': 'DiagnosticsProfile'}, + 'extension_profile': {'key': 'extensionProfile', 'type': 'VirtualMachineScaleSetExtensionProfile'}, + 'license_type': {'key': 'licenseType', 'type': 'str'}, + 'priority': {'key': 'priority', 'type': 'str'}, + 'eviction_policy': {'key': 'evictionPolicy', 'type': 'str'}, + 'billing_profile': {'key': 'billingProfile', 'type': 'BillingProfile'}, + 'scheduled_events_profile': {'key': 'scheduledEventsProfile', 'type': 'ScheduledEventsProfile'}, + 'user_data': {'key': 'userData', 'type': 'str'}, } + def __init__( + self, + *, + os_profile: Optional["VirtualMachineScaleSetOSProfile"] = None, + storage_profile: Optional["VirtualMachineScaleSetStorageProfile"] = None, + network_profile: Optional["VirtualMachineScaleSetNetworkProfile"] = None, + security_profile: Optional["SecurityProfile"] = None, + diagnostics_profile: Optional["DiagnosticsProfile"] = None, + extension_profile: Optional["VirtualMachineScaleSetExtensionProfile"] = None, + license_type: Optional[str] = None, + priority: Optional[Union[str, "VirtualMachinePriorityTypes"]] = None, + eviction_policy: Optional[Union[str, "VirtualMachineEvictionPolicyTypes"]] = None, + billing_profile: Optional["BillingProfile"] = None, + scheduled_events_profile: Optional["ScheduledEventsProfile"] = None, + user_data: Optional[str] = None, + **kwargs + ): + super(VirtualMachineScaleSetVMProfile, self).__init__(**kwargs) + self.os_profile = os_profile + self.storage_profile = storage_profile + self.network_profile = network_profile + self.security_profile = security_profile + self.diagnostics_profile = diagnostics_profile + self.extension_profile = extension_profile + self.license_type = license_type + self.priority = priority + self.eviction_policy = eviction_policy + self.billing_profile = billing_profile + self.scheduled_events_profile = scheduled_events_profile + self.user_data = user_data + + +class VirtualMachineScaleSetVMProtectionPolicy(msrest.serialization.Model): + """The protection policy of a virtual machine scale set VM. + + :param protect_from_scale_in: Indicates that the virtual machine scale set VM shouldn't be + considered for deletion during a scale-in operation. + :type protect_from_scale_in: bool + :param protect_from_scale_set_actions: Indicates that model updates or actions (including + scale-in) initiated on the virtual machine scale set should not be applied to the virtual + machine scale set VM. + :type protect_from_scale_set_actions: bool + """ + _attribute_map = { - 'network_interfaces': {'key': 'networkInterfaces', 'type': '[SubResource]'}, + 'protect_from_scale_in': {'key': 'protectFromScaleIn', 'type': 'bool'}, + 'protect_from_scale_set_actions': {'key': 'protectFromScaleSetActions', 'type': 'bool'}, } def __init__( self, + *, + protect_from_scale_in: Optional[bool] = None, + protect_from_scale_set_actions: Optional[bool] = None, **kwargs ): - super(RoleInstanceNetworkProfile, self).__init__(**kwargs) - self.network_interfaces = None + super(VirtualMachineScaleSetVMProtectionPolicy, self).__init__(**kwargs) + self.protect_from_scale_in = protect_from_scale_in + self.protect_from_scale_set_actions = protect_from_scale_set_actions -class RoleInstanceProperties(msrest.serialization.Model): - """RoleInstanceProperties. +class VirtualMachineSize(msrest.serialization.Model): + """Describes the properties of a VM size. - :param network_profile: Describes the network profile for the role instance. - :type network_profile: ~azure.mgmt.compute.v2021_03_01.models.RoleInstanceNetworkProfile - :param instance_view: The instance view of the role instance. - :type instance_view: ~azure.mgmt.compute.v2021_03_01.models.RoleInstanceView + :param name: The name of the virtual machine size. + :type name: str + :param number_of_cores: The number of cores supported by the virtual machine size. + :type number_of_cores: int + :param os_disk_size_in_mb: The OS disk size, in MB, allowed by the virtual machine size. + :type os_disk_size_in_mb: int + :param resource_disk_size_in_mb: The resource disk size, in MB, allowed by the virtual machine + size. + :type resource_disk_size_in_mb: int + :param memory_in_mb: The amount of memory, in MB, supported by the virtual machine size. + :type memory_in_mb: int + :param max_data_disk_count: The maximum number of data disks that can be attached to the + virtual machine size. + :type max_data_disk_count: int """ _attribute_map = { - 'network_profile': {'key': 'networkProfile', 'type': 'RoleInstanceNetworkProfile'}, - 'instance_view': {'key': 'instanceView', 'type': 'RoleInstanceView'}, + 'name': {'key': 'name', 'type': 'str'}, + 'number_of_cores': {'key': 'numberOfCores', 'type': 'int'}, + 'os_disk_size_in_mb': {'key': 'osDiskSizeInMB', 'type': 'int'}, + 'resource_disk_size_in_mb': {'key': 'resourceDiskSizeInMB', 'type': 'int'}, + 'memory_in_mb': {'key': 'memoryInMB', 'type': 'int'}, + 'max_data_disk_count': {'key': 'maxDataDiskCount', 'type': 'int'}, } def __init__( self, *, - network_profile: Optional["RoleInstanceNetworkProfile"] = None, - instance_view: Optional["RoleInstanceView"] = None, + name: Optional[str] = None, + number_of_cores: Optional[int] = None, + os_disk_size_in_mb: Optional[int] = None, + resource_disk_size_in_mb: Optional[int] = None, + memory_in_mb: Optional[int] = None, + max_data_disk_count: Optional[int] = None, **kwargs ): - super(RoleInstanceProperties, self).__init__(**kwargs) - self.network_profile = network_profile - self.instance_view = instance_view - + super(VirtualMachineSize, self).__init__(**kwargs) + self.name = name + self.number_of_cores = number_of_cores + self.os_disk_size_in_mb = os_disk_size_in_mb + self.resource_disk_size_in_mb = resource_disk_size_in_mb + self.memory_in_mb = memory_in_mb + self.max_data_disk_count = max_data_disk_count -class RoleInstances(msrest.serialization.Model): - """Specifies a list of role instances from the cloud service. - All required parameters must be populated in order to send to Azure. +class VirtualMachineSizeListResult(msrest.serialization.Model): + """The List Virtual Machine operation response. - :param role_instances: Required. List of cloud service role instance names. Value of '*' will - signify all role instances of the cloud service. - :type role_instances: list[str] + :param value: The list of virtual machine sizes. + :type value: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineSize] """ - _validation = { - 'role_instances': {'required': True}, - } - _attribute_map = { - 'role_instances': {'key': 'roleInstances', 'type': '[str]'}, + 'value': {'key': 'value', 'type': '[VirtualMachineSize]'}, } def __init__( self, *, - role_instances: List[str], + value: Optional[List["VirtualMachineSize"]] = None, **kwargs ): - super(RoleInstances, self).__init__(**kwargs) - self.role_instances = role_instances + super(VirtualMachineSizeListResult, self).__init__(**kwargs) + self.value = value -class RoleInstanceView(msrest.serialization.Model): - """The instance view of the role instance. +class VirtualMachineSoftwarePatchProperties(msrest.serialization.Model): + """Describes the properties of a Virtual Machine software patch. Variables are only populated by the server, and will be ignored when sending a request. - :ivar platform_update_domain: The Update Domain. - :vartype platform_update_domain: int - :ivar platform_fault_domain: The Fault Domain. - :vartype platform_fault_domain: int - :ivar private_id: Specifies a unique identifier generated internally for the cloud service - associated with this role instance. :code:`
    `:code:`
    ` NOTE: If you are using Azure - Diagnostics extension, this property can be used as 'DeploymentId' for querying details. - :vartype private_id: str - :ivar statuses: - :vartype statuses: list[~azure.mgmt.compute.v2021_03_01.models.ResourceInstanceViewStatus] + :ivar patch_id: A unique identifier for the patch. + :vartype patch_id: str + :ivar name: The friendly name of the patch. + :vartype name: str + :ivar version: The version number of the patch. This property applies only to Linux patches. + :vartype version: str + :ivar kb_id: The KBID of the patch. Only applies to Windows patches. + :vartype kb_id: str + :ivar classifications: The classification(s) of the patch as provided by the patch publisher. + :vartype classifications: list[str] + :ivar reboot_behavior: Describes the reboot requirements of the patch. Possible values include: + "Unknown", "NeverReboots", "AlwaysRequiresReboot", "CanRequestReboot". + :vartype reboot_behavior: str or + ~azure.mgmt.compute.v2021_03_01.models.VMGuestPatchRebootBehavior + :ivar activity_id: The activity ID of the operation that produced this result. It is used to + correlate across CRP and extension logs. + :vartype activity_id: str + :ivar published_date: The UTC timestamp when the repository published this patch. + :vartype published_date: ~datetime.datetime + :ivar last_modified_date_time: The UTC timestamp of the last update to this patch record. + :vartype last_modified_date_time: ~datetime.datetime + :ivar assessment_state: Describes the availability of a given patch. Possible values include: + "Unknown", "Available". + :vartype assessment_state: str or ~azure.mgmt.compute.v2021_03_01.models.PatchAssessmentState """ _validation = { - 'platform_update_domain': {'readonly': True}, - 'platform_fault_domain': {'readonly': True}, - 'private_id': {'readonly': True}, - 'statuses': {'readonly': True}, + 'patch_id': {'readonly': True}, + 'name': {'readonly': True}, + 'version': {'readonly': True}, + 'kb_id': {'readonly': True}, + 'classifications': {'readonly': True}, + 'reboot_behavior': {'readonly': True}, + 'activity_id': {'readonly': True}, + 'published_date': {'readonly': True}, + 'last_modified_date_time': {'readonly': True}, + 'assessment_state': {'readonly': True}, } _attribute_map = { - 'platform_update_domain': {'key': 'platformUpdateDomain', 'type': 'int'}, - 'platform_fault_domain': {'key': 'platformFaultDomain', 'type': 'int'}, - 'private_id': {'key': 'privateId', 'type': 'str'}, - 'statuses': {'key': 'statuses', 'type': '[ResourceInstanceViewStatus]'}, + 'patch_id': {'key': 'patchId', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + 'kb_id': {'key': 'kbId', 'type': 'str'}, + 'classifications': {'key': 'classifications', 'type': '[str]'}, + 'reboot_behavior': {'key': 'rebootBehavior', 'type': 'str'}, + 'activity_id': {'key': 'activityId', 'type': 'str'}, + 'published_date': {'key': 'publishedDate', 'type': 'iso-8601'}, + 'last_modified_date_time': {'key': 'lastModifiedDateTime', 'type': 'iso-8601'}, + 'assessment_state': {'key': 'assessmentState', 'type': 'str'}, } def __init__( self, **kwargs ): - super(RoleInstanceView, self).__init__(**kwargs) - self.platform_update_domain = None - self.platform_fault_domain = None - self.private_id = None - self.statuses = None + super(VirtualMachineSoftwarePatchProperties, self).__init__(**kwargs) + self.patch_id = None + self.name = None + self.version = None + self.kb_id = None + self.classifications = None + self.reboot_behavior = None + self.activity_id = None + self.published_date = None + self.last_modified_date_time = None + self.assessment_state = None -class StatusCodeCount(msrest.serialization.Model): - """StatusCodeCount. +class VirtualMachineStatusCodeCount(msrest.serialization.Model): + """The status code and count of the virtual machine scale set instance view status summary. Variables are only populated by the server, and will be ignored when sending a request. :ivar code: The instance view status code. :vartype code: str - :ivar count: Number of instances having this status code. + :ivar count: The number of instances having a particular status code. :vartype count: int """ @@ -1570,89 +10950,401 @@ def __init__( self, **kwargs ): - super(StatusCodeCount, self).__init__(**kwargs) + super(VirtualMachineStatusCodeCount, self).__init__(**kwargs) self.code = None self.count = None -class SubResource(msrest.serialization.Model): - """SubResource. +class VirtualMachineUpdate(UpdateResource): + """Describes a Virtual Machine Update. - :param id: Resource Id. - :type id: str + Variables are only populated by the server, and will be ignored when sending a request. + + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param plan: Specifies information about the marketplace image used to create the virtual + machine. This element is only used for marketplace images. Before you can use a marketplace + image from an API, you must enable the image for programmatic use. In the Azure portal, find + the marketplace image that you want to use and then click **Want to deploy programmatically, + Get Started ->**. Enter any required information and then click **Save**. + :type plan: ~azure.mgmt.compute.v2021_03_01.models.Plan + :param identity: The identity of the virtual machine, if configured. + :type identity: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineIdentity + :param zones: The virtual machine zones. + :type zones: list[str] + :param hardware_profile: Specifies the hardware settings for the virtual machine. + :type hardware_profile: ~azure.mgmt.compute.v2021_03_01.models.HardwareProfile + :param storage_profile: Specifies the storage settings for the virtual machine disks. + :type storage_profile: ~azure.mgmt.compute.v2021_03_01.models.StorageProfile + :param additional_capabilities: Specifies additional capabilities enabled or disabled on the + virtual machine. + :type additional_capabilities: ~azure.mgmt.compute.v2021_03_01.models.AdditionalCapabilities + :param os_profile: Specifies the operating system settings used while creating the virtual + machine. Some of the settings cannot be changed once VM is provisioned. + :type os_profile: ~azure.mgmt.compute.v2021_03_01.models.OSProfile + :param network_profile: Specifies the network interfaces of the virtual machine. + :type network_profile: ~azure.mgmt.compute.v2021_03_01.models.NetworkProfile + :param security_profile: Specifies the Security related profile settings for the virtual + machine. + :type security_profile: ~azure.mgmt.compute.v2021_03_01.models.SecurityProfile + :param diagnostics_profile: Specifies the boot diagnostic settings state. + :code:`
    `:code:`
    `Minimum api-version: 2015-06-15. + :type diagnostics_profile: ~azure.mgmt.compute.v2021_03_01.models.DiagnosticsProfile + :param availability_set: Specifies information about the availability set that the virtual + machine should be assigned to. Virtual machines specified in the same availability set are + allocated to different nodes to maximize availability. For more information about availability + sets, see `Manage the availability of virtual machines + `_. :code:`
    `:code:`
    ` + For more information on Azure planned maintenance, see `Planned maintenance for virtual + machines in Azure `_ + :code:`
    `:code:`
    ` Currently, a VM can only be added to availability set at creation + time. The availability set to which the VM is being added should be under the same resource + group as the availability set resource. An existing VM cannot be added to an availability set. + :code:`
    `:code:`
    `This property cannot exist along with a non-null + properties.virtualMachineScaleSet reference. + :type availability_set: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param virtual_machine_scale_set: Specifies information about the virtual machine scale set + that the virtual machine should be assigned to. Virtual machines specified in the same virtual + machine scale set are allocated to different nodes to maximize availability. Currently, a VM + can only be added to virtual machine scale set at creation time. An existing VM cannot be added + to a virtual machine scale set. :code:`
    `:code:`
    `This property cannot exist along with a + non-null properties.availabilitySet reference. :code:`
    `:code:`
    `Minimum api‐version: + 2019‐03‐01. + :type virtual_machine_scale_set: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param proximity_placement_group: Specifies information about the proximity placement group + that the virtual machine should be assigned to. :code:`
    `:code:`
    `Minimum api-version: + 2018-04-01. + :type proximity_placement_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param priority: Specifies the priority for the virtual machine. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. Possible values include: "Regular", + "Low", "Spot". + :type priority: str or ~azure.mgmt.compute.v2021_03_01.models.VirtualMachinePriorityTypes + :param eviction_policy: Specifies the eviction policy for the Azure Spot virtual machine and + Azure Spot scale set. :code:`
    `:code:`
    `For Azure Spot virtual machines, both + 'Deallocate' and 'Delete' are supported and the minimum api-version is 2019-03-01. + :code:`
    `:code:`
    `For Azure Spot scale sets, both 'Deallocate' and 'Delete' are supported + and the minimum api-version is 2017-10-30-preview. Possible values include: "Deallocate", + "Delete". + :type eviction_policy: str or + ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineEvictionPolicyTypes + :param billing_profile: Specifies the billing related details of a Azure Spot virtual machine. + :code:`
    `:code:`
    `Minimum api-version: 2019-03-01. + :type billing_profile: ~azure.mgmt.compute.v2021_03_01.models.BillingProfile + :param host: Specifies information about the dedicated host that the virtual machine resides + in. :code:`
    `:code:`
    `Minimum api-version: 2018-10-01. + :type host: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :param host_group: Specifies information about the dedicated host group that the virtual + machine resides in. :code:`
    `:code:`
    `Minimum api-version: 2020-06-01. + :code:`
    `:code:`
    `NOTE: User cannot specify both host and hostGroup properties. + :type host_group: ~azure.mgmt.compute.v2021_03_01.models.SubResource + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :ivar instance_view: The virtual machine instance view. + :vartype instance_view: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineInstanceView + :param license_type: Specifies that the image or disk that is being used was licensed on- + premises. :code:`
    `:code:`
    ` Possible values for Windows Server operating system are: + :code:`
    `:code:`
    ` Windows_Client :code:`
    `:code:`
    ` Windows_Server + :code:`
    `:code:`
    ` Possible values for Linux Server operating system are: + :code:`
    `:code:`
    ` RHEL_BYOS (for RHEL) :code:`
    `:code:`
    ` SLES_BYOS (for SUSE) + :code:`
    `:code:`
    ` For more information, see `Azure Hybrid Use Benefit for Windows Server + `_ + :code:`
    `:code:`
    ` `Azure Hybrid Use Benefit for Linux Server + `_ + :code:`
    `:code:`
    ` Minimum api-version: 2015-06-15. + :type license_type: str + :ivar vm_id: Specifies the VM unique ID which is a 128-bits identifier that is encoded and + stored in all Azure IaaS VMs SMBIOS and can be read using platform BIOS commands. + :vartype vm_id: str + :param extensions_time_budget: Specifies the time alloted for all extensions to start. The time + duration should be between 15 minutes and 120 minutes (inclusive) and should be specified in + ISO 8601 format. The default value is 90 minutes (PT1H30M). :code:`
    `:code:`
    ` Minimum + api-version: 2020-06-01. + :type extensions_time_budget: str + :param platform_fault_domain: Specifies the scale set logical fault domain into which the + Virtual Machine will be created. By default, the Virtual Machine will by automatically assigned + to a fault domain that best maintains balance across available fault + domains.:code:`
    `:code:`
  • `This is applicable only if the 'virtualMachineScaleSet' + property of this Virtual Machine is set.:code:`
  • `The Virtual Machine Scale Set that is + referenced, must have 'platformFaultDomainCount' > 1.:code:`
  • `This property cannot be + updated once the Virtual Machine is created.:code:`
  • `Fault domain assignment can be viewed + in the Virtual Machine Instance View.:code:`
    `:code:`
    `Minimum api‐version: 2020‐12‐01. + :type platform_fault_domain: int + :param user_data: UserData for the VM, which must be base-64 encoded. Customer should not pass + any secrets in here. :code:`
    `:code:`
    `Minimum api-version: 2021-03-01. + :type user_data: str """ + _validation = { + 'provisioning_state': {'readonly': True}, + 'instance_view': {'readonly': True}, + 'vm_id': {'readonly': True}, + } + _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'plan': {'key': 'plan', 'type': 'Plan'}, + 'identity': {'key': 'identity', 'type': 'VirtualMachineIdentity'}, + 'zones': {'key': 'zones', 'type': '[str]'}, + 'hardware_profile': {'key': 'properties.hardwareProfile', 'type': 'HardwareProfile'}, + 'storage_profile': {'key': 'properties.storageProfile', 'type': 'StorageProfile'}, + 'additional_capabilities': {'key': 'properties.additionalCapabilities', 'type': 'AdditionalCapabilities'}, + 'os_profile': {'key': 'properties.osProfile', 'type': 'OSProfile'}, + 'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'}, + 'security_profile': {'key': 'properties.securityProfile', 'type': 'SecurityProfile'}, + 'diagnostics_profile': {'key': 'properties.diagnosticsProfile', 'type': 'DiagnosticsProfile'}, + 'availability_set': {'key': 'properties.availabilitySet', 'type': 'SubResource'}, + 'virtual_machine_scale_set': {'key': 'properties.virtualMachineScaleSet', 'type': 'SubResource'}, + 'proximity_placement_group': {'key': 'properties.proximityPlacementGroup', 'type': 'SubResource'}, + 'priority': {'key': 'properties.priority', 'type': 'str'}, + 'eviction_policy': {'key': 'properties.evictionPolicy', 'type': 'str'}, + 'billing_profile': {'key': 'properties.billingProfile', 'type': 'BillingProfile'}, + 'host': {'key': 'properties.host', 'type': 'SubResource'}, + 'host_group': {'key': 'properties.hostGroup', 'type': 'SubResource'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'instance_view': {'key': 'properties.instanceView', 'type': 'VirtualMachineInstanceView'}, + 'license_type': {'key': 'properties.licenseType', 'type': 'str'}, + 'vm_id': {'key': 'properties.vmId', 'type': 'str'}, + 'extensions_time_budget': {'key': 'properties.extensionsTimeBudget', 'type': 'str'}, + 'platform_fault_domain': {'key': 'properties.platformFaultDomain', 'type': 'int'}, + 'user_data': {'key': 'properties.userData', 'type': 'str'}, } def __init__( self, *, - id: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + plan: Optional["Plan"] = None, + identity: Optional["VirtualMachineIdentity"] = None, + zones: Optional[List[str]] = None, + hardware_profile: Optional["HardwareProfile"] = None, + storage_profile: Optional["StorageProfile"] = None, + additional_capabilities: Optional["AdditionalCapabilities"] = None, + os_profile: Optional["OSProfile"] = None, + network_profile: Optional["NetworkProfile"] = None, + security_profile: Optional["SecurityProfile"] = None, + diagnostics_profile: Optional["DiagnosticsProfile"] = None, + availability_set: Optional["SubResource"] = None, + virtual_machine_scale_set: Optional["SubResource"] = None, + proximity_placement_group: Optional["SubResource"] = None, + priority: Optional[Union[str, "VirtualMachinePriorityTypes"]] = None, + eviction_policy: Optional[Union[str, "VirtualMachineEvictionPolicyTypes"]] = None, + billing_profile: Optional["BillingProfile"] = None, + host: Optional["SubResource"] = None, + host_group: Optional["SubResource"] = None, + license_type: Optional[str] = None, + extensions_time_budget: Optional[str] = None, + platform_fault_domain: Optional[int] = None, + user_data: Optional[str] = None, **kwargs ): - super(SubResource, self).__init__(**kwargs) - self.id = id - - -class UpdateDomain(msrest.serialization.Model): - """Defines an update domain for the cloud service. + super(VirtualMachineUpdate, self).__init__(tags=tags, **kwargs) + self.plan = plan + self.identity = identity + self.zones = zones + self.hardware_profile = hardware_profile + self.storage_profile = storage_profile + self.additional_capabilities = additional_capabilities + self.os_profile = os_profile + self.network_profile = network_profile + self.security_profile = security_profile + self.diagnostics_profile = diagnostics_profile + self.availability_set = availability_set + self.virtual_machine_scale_set = virtual_machine_scale_set + self.proximity_placement_group = proximity_placement_group + self.priority = priority + self.eviction_policy = eviction_policy + self.billing_profile = billing_profile + self.host = host + self.host_group = host_group + self.provisioning_state = None + self.instance_view = None + self.license_type = license_type + self.vm_id = None + self.extensions_time_budget = extensions_time_budget + self.platform_fault_domain = platform_fault_domain + self.user_data = user_data + + +class VMScaleSetConvertToSinglePlacementGroupInput(msrest.serialization.Model): + """VMScaleSetConvertToSinglePlacementGroupInput. + + :param active_placement_group_id: Id of the placement group in which you want future virtual + machine instances to be placed. To query placement group Id, please use Virtual Machine Scale + Set VMs - Get API. If not provided, the platform will choose one with maximum number of virtual + machine instances. + :type active_placement_group_id: str + """ - Variables are only populated by the server, and will be ignored when sending a request. + _attribute_map = { + 'active_placement_group_id': {'key': 'activePlacementGroupId', 'type': 'str'}, + } - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource Name. - :vartype name: str + def __init__( + self, + *, + active_placement_group_id: Optional[str] = None, + **kwargs + ): + super(VMScaleSetConvertToSinglePlacementGroupInput, self).__init__(**kwargs) + self.active_placement_group_id = active_placement_group_id + + +class WindowsConfiguration(msrest.serialization.Model): + """Specifies Windows operating system settings on the virtual machine. + + :param provision_vm_agent: Indicates whether virtual machine agent should be provisioned on the + virtual machine. :code:`
    `:code:`
    ` When this property is not specified in the request + body, default behavior is to set it to true. This will ensure that VM Agent is installed on + the VM so that extensions can be added to the VM later. + :type provision_vm_agent: bool + :param enable_automatic_updates: Indicates whether Automatic Updates is enabled for the Windows + virtual machine. Default value is true. :code:`
    `:code:`
    ` For virtual machine scale + sets, this property can be updated and updates will take effect on OS reprovisioning. + :type enable_automatic_updates: bool + :param time_zone: Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". + :code:`
    `:code:`
    ` Possible values can be `TimeZoneInfo.Id + `_ + value from time zones returned by `TimeZoneInfo.GetSystemTimeZones + `_. + :type time_zone: str + :param additional_unattend_content: Specifies additional base-64 encoded XML formatted + information that can be included in the Unattend.xml file, which is used by Windows Setup. + :type additional_unattend_content: + list[~azure.mgmt.compute.v2021_03_01.models.AdditionalUnattendContent] + :param patch_settings: [Preview Feature] Specifies settings related to VM Guest Patching on + Windows. + :type patch_settings: ~azure.mgmt.compute.v2021_03_01.models.PatchSettings + :param win_rm: Specifies the Windows Remote Management listeners. This enables remote Windows + PowerShell. + :type win_rm: ~azure.mgmt.compute.v2021_03_01.models.WinRMConfiguration """ - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, + _attribute_map = { + 'provision_vm_agent': {'key': 'provisionVMAgent', 'type': 'bool'}, + 'enable_automatic_updates': {'key': 'enableAutomaticUpdates', 'type': 'bool'}, + 'time_zone': {'key': 'timeZone', 'type': 'str'}, + 'additional_unattend_content': {'key': 'additionalUnattendContent', 'type': '[AdditionalUnattendContent]'}, + 'patch_settings': {'key': 'patchSettings', 'type': 'PatchSettings'}, + 'win_rm': {'key': 'winRM', 'type': 'WinRMConfiguration'}, } + def __init__( + self, + *, + provision_vm_agent: Optional[bool] = None, + enable_automatic_updates: Optional[bool] = None, + time_zone: Optional[str] = None, + additional_unattend_content: Optional[List["AdditionalUnattendContent"]] = None, + patch_settings: Optional["PatchSettings"] = None, + win_rm: Optional["WinRMConfiguration"] = None, + **kwargs + ): + super(WindowsConfiguration, self).__init__(**kwargs) + self.provision_vm_agent = provision_vm_agent + self.enable_automatic_updates = enable_automatic_updates + self.time_zone = time_zone + self.additional_unattend_content = additional_unattend_content + self.patch_settings = patch_settings + self.win_rm = win_rm + + +class WindowsParameters(msrest.serialization.Model): + """Input for InstallPatches on a Windows VM, as directly received by the API. + + :param classifications_to_include: The update classifications to select when installing patches + for Windows. + :type classifications_to_include: list[str or + ~azure.mgmt.compute.v2021_03_01.models.VMGuestPatchClassificationWindows] + :param kb_numbers_to_include: Kbs to include in the patch operation. + :type kb_numbers_to_include: list[str] + :param kb_numbers_to_exclude: Kbs to exclude in the patch operation. + :type kb_numbers_to_exclude: list[str] + :param exclude_kbs_requiring_reboot: Filters out Kbs that don't have an + InstallationRebootBehavior of 'NeverReboots' when this is set to true. + :type exclude_kbs_requiring_reboot: bool + :param max_patch_publish_date: This is used to install patches that were published on or before + this given max published date. + :type max_patch_publish_date: ~datetime.datetime + """ + _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, + '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'}, } def __init__( self, + *, + classifications_to_include: Optional[List[Union[str, "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 ): - super(UpdateDomain, self).__init__(**kwargs) - self.id = None - self.name = None - + super(WindowsParameters, self).__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 -class UpdateDomainListResult(msrest.serialization.Model): - """UpdateDomainListResult. - All required parameters must be populated in order to send to Azure. +class WinRMConfiguration(msrest.serialization.Model): + """Describes Windows Remote Management configuration of the VM. - :param value: Required. - :type value: list[~azure.mgmt.compute.v2021_03_01.models.UpdateDomain] - :param next_link: - :type next_link: str + :param listeners: The list of Windows Remote Management listeners. + :type listeners: list[~azure.mgmt.compute.v2021_03_01.models.WinRMListener] """ - _validation = { - 'value': {'required': True}, + _attribute_map = { + 'listeners': {'key': 'listeners', 'type': '[WinRMListener]'}, } + def __init__( + self, + *, + listeners: Optional[List["WinRMListener"]] = None, + **kwargs + ): + super(WinRMConfiguration, self).__init__(**kwargs) + self.listeners = listeners + + +class WinRMListener(msrest.serialization.Model): + """Describes Protocol and thumbprint of Windows Remote Management listener. + + :param protocol: Specifies the protocol of WinRM listener. :code:`
    `:code:`
    ` Possible + values are: :code:`
    `\ **http** :code:`
    `:code:`
    ` **https**. Possible values include: + "Http", "Https". + :type protocol: str or ~azure.mgmt.compute.v2021_03_01.models.ProtocolTypes + :param certificate_url: This is the URL of a certificate that has been uploaded to Key Vault as + a secret. For adding a secret to the Key Vault, see `Add a key or secret to the key vault + `_. In this case, your + certificate needs to be It is the Base64 encoding of the following JSON Object which is encoded + in UTF-8: :code:`
    `:code:`
    ` {:code:`
    ` "data":":code:``",:code:`
    ` "dataType":"pfx",:code:`
    ` "password":":code:``":code:`
    `}. + :type certificate_url: str + """ + _attribute_map = { - 'value': {'key': 'value', 'type': '[UpdateDomain]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'protocol': {'key': 'protocol', 'type': 'str'}, + 'certificate_url': {'key': 'certificateUrl', 'type': 'str'}, } def __init__( self, *, - value: List["UpdateDomain"], - next_link: Optional[str] = None, + protocol: Optional[Union[str, "ProtocolTypes"]] = None, + certificate_url: Optional[str] = None, **kwargs ): - super(UpdateDomainListResult, self).__init__(**kwargs) - self.value = value - self.next_link = next_link + super(WinRMListener, self).__init__(**kwargs) + self.protocol = protocol + self.certificate_url = certificate_url diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/__init__.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/__init__.py index 4e620f184dcb1..3c3908367f0ce 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/__init__.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/__init__.py @@ -11,6 +11,28 @@ from ._cloud_services_operations import CloudServicesOperations from ._cloud_services_update_domain_operations import CloudServicesUpdateDomainOperations from ._cloud_service_operating_systems_operations import CloudServiceOperatingSystemsOperations +from ._operations import Operations +from ._availability_sets_operations import AvailabilitySetsOperations +from ._proximity_placement_groups_operations import ProximityPlacementGroupsOperations +from ._dedicated_host_groups_operations import DedicatedHostGroupsOperations +from ._dedicated_hosts_operations import DedicatedHostsOperations +from ._ssh_public_keys_operations import SshPublicKeysOperations +from ._virtual_machine_extension_images_operations import VirtualMachineExtensionImagesOperations +from ._virtual_machine_extensions_operations import VirtualMachineExtensionsOperations +from ._virtual_machine_images_operations import VirtualMachineImagesOperations +from ._virtual_machine_images_edge_zone_operations import VirtualMachineImagesEdgeZoneOperations +from ._usage_operations import UsageOperations +from ._virtual_machines_operations import VirtualMachinesOperations +from ._virtual_machine_scale_sets_operations import VirtualMachineScaleSetsOperations +from ._virtual_machine_sizes_operations import VirtualMachineSizesOperations +from ._images_operations import ImagesOperations +from ._virtual_machine_scale_set_extensions_operations import VirtualMachineScaleSetExtensionsOperations +from ._virtual_machine_scale_set_rolling_upgrades_operations import VirtualMachineScaleSetRollingUpgradesOperations +from ._virtual_machine_scale_set_vm_extensions_operations import VirtualMachineScaleSetVMExtensionsOperations +from ._virtual_machine_scale_set_vms_operations import VirtualMachineScaleSetVMsOperations +from ._log_analytics_operations import LogAnalyticsOperations +from ._virtual_machine_run_commands_operations import VirtualMachineRunCommandsOperations +from ._virtual_machine_scale_set_vm_run_commands_operations import VirtualMachineScaleSetVMRunCommandsOperations __all__ = [ 'CloudServiceRoleInstancesOperations', @@ -18,4 +40,26 @@ 'CloudServicesOperations', 'CloudServicesUpdateDomainOperations', 'CloudServiceOperatingSystemsOperations', + 'Operations', + 'AvailabilitySetsOperations', + 'ProximityPlacementGroupsOperations', + 'DedicatedHostGroupsOperations', + 'DedicatedHostsOperations', + 'SshPublicKeysOperations', + 'VirtualMachineExtensionImagesOperations', + 'VirtualMachineExtensionsOperations', + 'VirtualMachineImagesOperations', + 'VirtualMachineImagesEdgeZoneOperations', + 'UsageOperations', + 'VirtualMachinesOperations', + 'VirtualMachineScaleSetsOperations', + 'VirtualMachineSizesOperations', + 'ImagesOperations', + 'VirtualMachineScaleSetExtensionsOperations', + 'VirtualMachineScaleSetRollingUpgradesOperations', + 'VirtualMachineScaleSetVMExtensionsOperations', + 'VirtualMachineScaleSetVMsOperations', + 'LogAnalyticsOperations', + 'VirtualMachineRunCommandsOperations', + 'VirtualMachineScaleSetVMRunCommandsOperations', ] diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_availability_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_availability_sets_operations.py new file mode 100644 index 0000000000000..a0edd7868f13c --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_availability_sets_operations.py @@ -0,0 +1,513 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class AvailabilitySetsOperations(object): + """AvailabilitySetsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def create_or_update( + self, + resource_group_name, # type: str + availability_set_name, # type: str + parameters, # type: "_models.AvailabilitySet" + **kwargs # type: Any + ): + # type: (...) -> "_models.AvailabilitySet" + """Create or update an availability set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. + :type availability_set_name: str + :param parameters: Parameters supplied to the Create Availability Set operation. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.AvailabilitySet + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AvailabilitySet, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.AvailabilitySet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'availabilitySetName': self._serialize.url("availability_set_name", availability_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'AvailabilitySet') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AvailabilitySet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + availability_set_name, # type: str + parameters, # type: "_models.AvailabilitySetUpdate" + **kwargs # type: Any + ): + # type: (...) -> "_models.AvailabilitySet" + """Update an availability set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. + :type availability_set_name: str + :param parameters: Parameters supplied to the Update Availability Set operation. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.AvailabilitySetUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AvailabilitySet, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.AvailabilitySet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'availabilitySetName': self._serialize.url("availability_set_name", availability_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'AvailabilitySetUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AvailabilitySet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + availability_set_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Delete an availability set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. + :type availability_set_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 + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'availabilitySetName': self._serialize.url("availability_set_name", availability_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + availability_set_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AvailabilitySet" + """Retrieves information about an availability set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. + :type availability_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AvailabilitySet, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.AvailabilitySet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'availabilitySetName': self._serialize.url("availability_set_name", availability_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AvailabilitySet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}'} # type: ignore + + def list_by_subscription( + self, + expand=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AvailabilitySetListResult"] + """Lists all availability sets in a subscription. + + :param expand: The expand expression to apply to the operation. Allowed values are + 'instanceView'. + :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 AvailabilitySetListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.AvailabilitySetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + + def list( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AvailabilitySetListResult"] + """Lists all availability sets in a resource group. + + :param resource_group_name: The name of the resource group. + :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 AvailabilitySetListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.AvailabilitySetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailabilitySetListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('AvailabilitySetListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets'} # type: ignore + + def list_available_sizes( + self, + resource_group_name, # type: str + availability_set_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + """Lists all available virtual machine sizes that can be used to create a new virtual machine in + an existing availability set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param availability_set_name: The name of the availability set. + :type availability_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineSizeListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_available_sizes.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'availabilitySetName': self._serialize.url("availability_set_name", availability_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_available_sizes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}/vmSizes'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_service_role_instances_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_service_role_instances_operations.py index 084d95f8be021..10d51ba2a7753 100644 --- a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_service_role_instances_operations.py +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_cloud_service_role_instances_operations.py @@ -169,7 +169,7 @@ def get( role_instance_name, # type: str resource_group_name, # type: str cloud_service_name, # type: str - expand="instanceView", # type: Optional[str] + expand=None, # type: Optional[Union[str, "_models.InstanceViewTypes"]] **kwargs # type: Any ): # type: (...) -> "_models.RoleInstance" @@ -182,7 +182,7 @@ def get( :param cloud_service_name: :type cloud_service_name: str :param expand: The expand expression to apply to the operation. - :type expand: str + :type expand: str or ~azure.mgmt.compute.v2021_03_01.models.InstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response :return: RoleInstance, or the result of cls(response) :rtype: ~azure.mgmt.compute.v2021_03_01.models.RoleInstance @@ -299,7 +299,7 @@ def list( self, resource_group_name, # type: str cloud_service_name, # type: str - expand="instanceView", # type: Optional[str] + expand=None, # type: Optional[Union[str, "_models.InstanceViewTypes"]] **kwargs # type: Any ): # type: (...) -> Iterable["_models.RoleInstanceListResult"] @@ -312,7 +312,7 @@ def list( :param cloud_service_name: :type cloud_service_name: str :param expand: The expand expression to apply to the operation. - :type expand: str + :type expand: str or ~azure.mgmt.compute.v2021_03_01.models.InstanceViewTypes :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RoleInstanceListResult or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.RoleInstanceListResult] diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_dedicated_host_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_dedicated_host_groups_operations.py new file mode 100644 index 0000000000000..89835bc4cd301 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_dedicated_host_groups_operations.py @@ -0,0 +1,445 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class DedicatedHostGroupsOperations(object): + """DedicatedHostGroupsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def create_or_update( + self, + resource_group_name, # type: str + host_group_name, # type: str + parameters, # type: "_models.DedicatedHostGroup" + **kwargs # type: Any + ): + # type: (...) -> "_models.DedicatedHostGroup" + """Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host + Groups please see [Dedicated Host Documentation] + (https://go.microsoft.com/fwlink/?linkid=2082596). + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_group_name: str + :param parameters: Parameters supplied to the Create Dedicated Host Group. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.DedicatedHostGroup + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DedicatedHostGroup, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.DedicatedHostGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'hostGroupName': self._serialize.url("host_group_name", host_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'DedicatedHostGroup') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DedicatedHostGroup', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DedicatedHostGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + host_group_name, # type: str + parameters, # type: "_models.DedicatedHostGroupUpdate" + **kwargs # type: Any + ): + # type: (...) -> "_models.DedicatedHostGroup" + """Update an dedicated host group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_group_name: str + :param parameters: Parameters supplied to the Update Dedicated Host Group operation. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.DedicatedHostGroupUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DedicatedHostGroup, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.DedicatedHostGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'hostGroupName': self._serialize.url("host_group_name", host_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'DedicatedHostGroupUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DedicatedHostGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + host_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Delete a dedicated host group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_group_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 + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'hostGroupName': self._serialize.url("host_group_name", host_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + host_group_name, # type: str + expand=None, # type: Optional[Union[str, "_models.InstanceViewTypes"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.DedicatedHostGroup" + """Retrieves information about a dedicated host group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_group_name: str + :param expand: The expand expression to apply on the operation. The response shows the list of + instance view of the dedicated hosts under the dedicated host group. + :type expand: str or ~azure.mgmt.compute.v2021_03_01.models.InstanceViewTypes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DedicatedHostGroup, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.DedicatedHostGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'hostGroupName': self._serialize.url("host_group_name", host_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DedicatedHostGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DedicatedHostGroupListResult"] + """Lists all of the dedicated host groups in the specified resource group. Use the nextLink + property in the response to get the next page of dedicated host groups. + + :param resource_group_name: The name of the resource group. + :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 DedicatedHostGroupListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.DedicatedHostGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DedicatedHostGroupListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups'} # type: ignore + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DedicatedHostGroupListResult"] + """Lists all of the dedicated host groups in the subscription. Use the nextLink property in the + response to get the next page of dedicated host groups. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DedicatedHostGroupListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.DedicatedHostGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostGroupListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DedicatedHostGroupListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/hostGroups'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_dedicated_hosts_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_dedicated_hosts_operations.py new file mode 100644 index 0000000000000..ebbd86219dcb4 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_dedicated_hosts_operations.py @@ -0,0 +1,577 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class DedicatedHostsOperations(object): + """DedicatedHostsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _create_or_update_initial( + self, + resource_group_name, # type: str + host_group_name, # type: str + host_name, # type: str + parameters, # type: "_models.DedicatedHost" + **kwargs # type: Any + ): + # type: (...) -> "_models.DedicatedHost" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'hostGroupName': self._serialize.url("host_group_name", host_group_name, 'str'), + 'hostName': self._serialize.url("host_name", host_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'DedicatedHost') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DedicatedHost', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DedicatedHost', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + host_group_name, # type: str + host_name, # type: str + parameters, # type: "_models.DedicatedHost" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.DedicatedHost"] + """Create or update a dedicated host . + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_group_name: str + :param host_name: The name of the dedicated host . + :type host_name: str + :param parameters: Parameters supplied to the Create Dedicated Host. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.DedicatedHost + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 DedicatedHost or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.DedicatedHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DedicatedHost', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'hostGroupName': self._serialize.url("host_group_name", host_group_name, 'str'), + 'hostName': self._serialize.url("host_name", host_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + host_group_name, # type: str + host_name, # type: str + parameters, # type: "_models.DedicatedHostUpdate" + **kwargs # type: Any + ): + # type: (...) -> "_models.DedicatedHost" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'hostGroupName': self._serialize.url("host_group_name", host_group_name, 'str'), + 'hostName': self._serialize.url("host_name", host_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'DedicatedHostUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DedicatedHost', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + host_group_name, # type: str + host_name, # type: str + parameters, # type: "_models.DedicatedHostUpdate" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.DedicatedHost"] + """Update an dedicated host . + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_group_name: str + :param host_name: The name of the dedicated host . + :type host_name: str + :param parameters: Parameters supplied to the Update Dedicated Host operation. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.DedicatedHostUpdate + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 DedicatedHost or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.DedicatedHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DedicatedHost', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'hostGroupName': self._serialize.url("host_group_name", host_group_name, 'str'), + 'hostName': self._serialize.url("host_name", host_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + host_group_name, # type: str + host_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'hostGroupName': self._serialize.url("host_group_name", host_group_name, 'str'), + 'hostName': self._serialize.url("host_name", host_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + host_group_name, # type: str + host_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Delete a dedicated host. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_group_name: str + :param host_name: The name of the dedicated host. + :type host_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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + host_group_name=host_group_name, + host_name=host_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'hostGroupName': self._serialize.url("host_group_name", host_group_name, 'str'), + 'hostName': self._serialize.url("host_name", host_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + host_group_name, # type: str + host_name, # type: str + expand=None, # type: Optional[Union[str, "_models.InstanceViewTypes"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.DedicatedHost" + """Retrieves information about a dedicated host. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_group_name: str + :param host_name: The name of the dedicated host. + :type host_name: str + :param expand: The expand expression to apply on the operation. + :type expand: str or ~azure.mgmt.compute.v2021_03_01.models.InstanceViewTypes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DedicatedHost, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.DedicatedHost + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHost"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'hostGroupName': self._serialize.url("host_group_name", host_group_name, 'str'), + 'hostName': self._serialize.url("host_name", host_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DedicatedHost', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts/{hostName}'} # type: ignore + + def list_by_host_group( + self, + resource_group_name, # type: str + host_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DedicatedHostListResult"] + """Lists all of the dedicated hosts in the specified dedicated host group. Use the nextLink + property in the response to get the next page of dedicated hosts. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param host_group_name: The name of the dedicated host group. + :type host_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 DedicatedHostListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.DedicatedHostListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DedicatedHostListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_host_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'hostGroupName': self._serialize.url("host_group_name", host_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DedicatedHostListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_host_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}/hosts'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_images_operations.py new file mode 100644 index 0000000000000..d5ce647a667b5 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_images_operations.py @@ -0,0 +1,619 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ImagesOperations(object): + """ImagesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _create_or_update_initial( + self, + resource_group_name, # type: str + image_name, # type: str + parameters, # type: "_models.Image" + **kwargs # type: Any + ): + # type: (...) -> "_models.Image" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'imageName': self._serialize.url("image_name", image_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'Image') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Image', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Image', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + image_name, # type: str + parameters, # type: "_models.Image" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.Image"] + """Create or update an image. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param image_name: The name of the image. + :type image_name: str + :param parameters: Parameters supplied to the Create Image operation. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.Image + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 Image or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.Image] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + image_name=image_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Image', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'imageName': self._serialize.url("image_name", image_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + image_name, # type: str + parameters, # type: "_models.ImageUpdate" + **kwargs # type: Any + ): + # type: (...) -> "_models.Image" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'imageName': self._serialize.url("image_name", image_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ImageUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Image', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Image', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + image_name, # type: str + parameters, # type: "_models.ImageUpdate" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.Image"] + """Update an image. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param image_name: The name of the image. + :type image_name: str + :param parameters: Parameters supplied to the Update Image operation. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.ImageUpdate + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 Image or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.Image] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + image_name=image_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Image', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'imageName': self._serialize.url("image_name", image_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + image_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'imageName': self._serialize.url("image_name", image_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + image_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes an Image. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param image_name: The name of the image. + :type image_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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + image_name=image_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'imageName': self._serialize.url("image_name", image_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + image_name, # type: str + expand=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.Image" + """Gets an image. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param image_name: The name of the image. + :type image_name: str + :param expand: The expand expression to apply on the operation. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Image, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.Image + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Image"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'imageName': self._serialize.url("image_name", image_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Image', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ImageListResult"] + """Gets the list of images under a resource group. + + :param resource_group_name: The name of the resource group. + :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 ImageListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.ImageListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ImageListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images'} # type: ignore + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ImageListResult"] + """Gets the list of Images in the subscription. Use nextLink property in the response to get the + next page of Images. Do this till nextLink is null to fetch all the Images. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ImageListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.ImageListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ImageListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ImageListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/images'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_log_analytics_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_log_analytics_operations.py new file mode 100644 index 0000000000000..c15504a1c8260 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_log_analytics_operations.py @@ -0,0 +1,291 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class LogAnalyticsOperations(object): + """LogAnalyticsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _export_request_rate_by_interval_initial( + self, + location, # type: str + parameters, # type: "_models.RequestRateByIntervalInput" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.LogAnalyticsOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LogAnalyticsOperationResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._export_request_rate_by_interval_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RequestRateByIntervalInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('LogAnalyticsOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _export_request_rate_by_interval_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval'} # type: ignore + + def begin_export_request_rate_by_interval( + self, + location, # type: str + parameters, # type: "_models.RequestRateByIntervalInput" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.LogAnalyticsOperationResult"] + """Export logs that show Api requests made by this subscription in the given time window to show + throttling activities. + + :param location: The location upon which virtual-machine-sizes is queried. + :type location: str + :param parameters: Parameters supplied to the LogAnalytics getRequestRateByInterval Api. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.RequestRateByIntervalInput + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 LogAnalyticsOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.LogAnalyticsOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._export_request_rate_by_interval_initial( + location=location, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('LogAnalyticsOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_export_request_rate_by_interval.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getRequestRateByInterval'} # type: ignore + + def _export_throttled_requests_initial( + self, + location, # type: str + parameters, # type: "_models.ThrottledRequestsInput" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.LogAnalyticsOperationResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.LogAnalyticsOperationResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._export_throttled_requests_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ThrottledRequestsInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('LogAnalyticsOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _export_throttled_requests_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests'} # type: ignore + + def begin_export_throttled_requests( + self, + location, # type: str + parameters, # type: "_models.ThrottledRequestsInput" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.LogAnalyticsOperationResult"] + """Export logs that show total throttled Api requests for this subscription in the given time + window. + + :param location: The location upon which virtual-machine-sizes is queried. + :type location: str + :param parameters: Parameters supplied to the LogAnalytics getThrottledRequests Api. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.ThrottledRequestsInput + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 LogAnalyticsOperationResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.LogAnalyticsOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.LogAnalyticsOperationResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._export_throttled_requests_initial( + location=location, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('LogAnalyticsOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_export_throttled_requests.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/logAnalytics/apiAccess/getThrottledRequests'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_operations.py new file mode 100644 index 0000000000000..9fbb3dc0b6147 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_operations.py @@ -0,0 +1,109 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class Operations(object): + """Operations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ComputeOperationListResult"] + """Gets a list of compute operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ComputeOperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.ComputeOperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ComputeOperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ComputeOperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.Compute/operations'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_proximity_placement_groups_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_proximity_placement_groups_operations.py new file mode 100644 index 0000000000000..b814207fa3fff --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_proximity_placement_groups_operations.py @@ -0,0 +1,441 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ProximityPlacementGroupsOperations(object): + """ProximityPlacementGroupsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def create_or_update( + self, + resource_group_name, # type: str + proximity_placement_group_name, # type: str + parameters, # type: "_models.ProximityPlacementGroup" + **kwargs # type: Any + ): + # type: (...) -> "_models.ProximityPlacementGroup" + """Create or update a proximity placement group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. + :type proximity_placement_group_name: str + :param parameters: Parameters supplied to the Create Proximity Placement Group operation. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.ProximityPlacementGroup + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProximityPlacementGroup, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.ProximityPlacementGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'proximityPlacementGroupName': self._serialize.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ProximityPlacementGroup') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ProximityPlacementGroup', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ProximityPlacementGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + proximity_placement_group_name, # type: str + parameters, # type: "_models.ProximityPlacementGroupUpdate" + **kwargs # type: Any + ): + # type: (...) -> "_models.ProximityPlacementGroup" + """Update a proximity placement group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. + :type proximity_placement_group_name: str + :param parameters: Parameters supplied to the Update Proximity Placement Group operation. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.ProximityPlacementGroupUpdate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProximityPlacementGroup, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.ProximityPlacementGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'proximityPlacementGroupName': self._serialize.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ProximityPlacementGroupUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ProximityPlacementGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + proximity_placement_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Delete a proximity placement group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. + :type proximity_placement_group_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 + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'proximityPlacementGroupName': self._serialize.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + proximity_placement_group_name, # type: str + include_colocation_status=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.ProximityPlacementGroup" + """Retrieves information about a proximity placement group . + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param proximity_placement_group_name: The name of the proximity placement group. + :type proximity_placement_group_name: str + :param include_colocation_status: includeColocationStatus=true enables fetching the colocation + status of all the resources in the proximity placement group. + :type include_colocation_status: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ProximityPlacementGroup, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.ProximityPlacementGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'proximityPlacementGroupName': self._serialize.url("proximity_placement_group_name", proximity_placement_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if include_colocation_status is not None: + query_parameters['includeColocationStatus'] = self._serialize.query("include_colocation_status", include_colocation_status, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ProximityPlacementGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups/{proximityPlacementGroupName}'} # type: ignore + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ProximityPlacementGroupListResult"] + """Lists all proximity placement groups 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 ProximityPlacementGroupListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.ProximityPlacementGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/proximityPlacementGroups'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ProximityPlacementGroupListResult"] + """Lists all proximity placement groups in a resource group. + + :param resource_group_name: The name of the resource group. + :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 ProximityPlacementGroupListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.ProximityPlacementGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProximityPlacementGroupListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ProximityPlacementGroupListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/proximityPlacementGroups'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_ssh_public_keys_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_ssh_public_keys_operations.py new file mode 100644 index 0000000000000..4cc22211d41aa --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_ssh_public_keys_operations.py @@ -0,0 +1,498 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class SshPublicKeysOperations(object): + """SshPublicKeysOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SshPublicKeysGroupListResult"] + """Lists all of the SSH public keys in the subscription. Use the nextLink property in the response + to get the next page of SSH public keys. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SshPublicKeysGroupListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.SshPublicKeysGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SshPublicKeysGroupListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/sshPublicKeys'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SshPublicKeysGroupListResult"] + """Lists all of the SSH public keys in the specified resource group. Use the nextLink property in + the response to get the next page of SSH public keys. + + :param resource_group_name: The name of the resource group. + :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 SshPublicKeysGroupListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.SshPublicKeysGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeysGroupListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SshPublicKeysGroupListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys'} # type: ignore + + def create( + self, + resource_group_name, # type: str + ssh_public_key_name, # type: str + parameters, # type: "_models.SshPublicKeyResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.SshPublicKeyResource" + """Creates a new SSH public key resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to create the SSH public key. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.SshPublicKeyResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SshPublicKeyResource, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.SshPublicKeyResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeyResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'sshPublicKeyName': self._serialize.url("ssh_public_key_name", ssh_public_key_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SshPublicKeyResource') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SshPublicKeyResource', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SshPublicKeyResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + ssh_public_key_name, # type: str + parameters, # type: "_models.SshPublicKeyUpdateResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.SshPublicKeyResource" + """Updates a new SSH public key resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. + :type ssh_public_key_name: str + :param parameters: Parameters supplied to update the SSH public key. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.SshPublicKeyUpdateResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SshPublicKeyResource, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.SshPublicKeyResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeyResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'sshPublicKeyName': self._serialize.url("ssh_public_key_name", ssh_public_key_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SshPublicKeyUpdateResource') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SshPublicKeyResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + ssh_public_key_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Delete an SSH public key. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. + :type ssh_public_key_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 + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'sshPublicKeyName': self._serialize.url("ssh_public_key_name", ssh_public_key_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + ssh_public_key_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SshPublicKeyResource" + """Retrieves information about an SSH public key. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. + :type ssh_public_key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SshPublicKeyResource, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.SshPublicKeyResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeyResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'sshPublicKeyName': self._serialize.url("ssh_public_key_name", ssh_public_key_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SshPublicKeyResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}'} # type: ignore + + def generate_key_pair( + self, + resource_group_name, # type: str + ssh_public_key_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SshPublicKeyGenerateKeyPairResult" + """Generates and returns a public/private key pair and populates the SSH public key resource with + the public key. The length of the key will be 3072 bits. This operation can only be performed + once per SSH public key resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param ssh_public_key_name: The name of the SSH public key. + :type ssh_public_key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SshPublicKeyGenerateKeyPairResult, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.SshPublicKeyGenerateKeyPairResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SshPublicKeyGenerateKeyPairResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.generate_key_pair.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'sshPublicKeyName': self._serialize.url("ssh_public_key_name", ssh_public_key_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SshPublicKeyGenerateKeyPairResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + generate_key_pair.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{sshPublicKeyName}/generateKeyPair'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_usage_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_usage_operations.py new file mode 100644 index 0000000000000..ba685ab6e0477 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_usage_operations.py @@ -0,0 +1,118 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class UsageOperations(object): + """UsageOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + location, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ListUsagesResult"] + """Gets, for the specified location, the current compute resource usage information as well as the + limits for compute resources under the subscription. + + :param location: The location for which resource usage is queried. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ListUsagesResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.ListUsagesResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListUsagesResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ListUsagesResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/usages'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_extension_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_extension_images_operations.py new file mode 100644 index 0000000000000..adb6fd9e159aa --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_extension_images_operations.py @@ -0,0 +1,249 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class VirtualMachineExtensionImagesOperations(object): + """VirtualMachineExtensionImagesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + location, # type: str + publisher_name, # type: str + type, # type: str + version, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualMachineExtensionImage" + """Gets a virtual machine extension image. + + :param location: The name of a supported Azure region. + :type location: str + :param publisher_name: + :type publisher_name: str + :param type: + :type type: str + :param version: + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineExtensionImage, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtensionImage + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtensionImage"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'publisherName': self._serialize.url("publisher_name", publisher_name, 'str'), + 'type': self._serialize.url("type", type, 'str'), + 'version': self._serialize.url("version", version, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineExtensionImage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions/{version}'} # type: ignore + + def list_types( + self, + location, # type: str + publisher_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["_models.VirtualMachineExtensionImage"] + """Gets a list of virtual machine extension image types. + + :param location: The name of a supported Azure region. + :type location: str + :param publisher_name: + :type publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VirtualMachineExtensionImage, or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtensionImage] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineExtensionImage"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.list_types.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'publisherName': self._serialize.url("publisher_name", publisher_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineExtensionImage]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_types.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types'} # type: ignore + + def list_versions( + self, + location, # type: str + publisher_name, # type: str + type, # type: str + filter=None, # type: Optional[str] + top=None, # type: Optional[int] + orderby=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> List["_models.VirtualMachineExtensionImage"] + """Gets a list of virtual machine extension image versions. + + :param location: The name of a supported Azure region. + :type location: str + :param publisher_name: + :type publisher_name: str + :param type: + :type type: str + :param filter: The filter to apply on the operation. + :type filter: str + :param top: + :type top: int + :param orderby: + :type orderby: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VirtualMachineExtensionImage, or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtensionImage] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineExtensionImage"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.list_versions.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'publisherName': self._serialize.url("publisher_name", publisher_name, 'str'), + 'type': self._serialize.url("type", type, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineExtensionImage]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_versions.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmextension/types/{type}/versions'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_extensions_operations.py new file mode 100644 index 0000000000000..d0f8225884726 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_extensions_operations.py @@ -0,0 +1,567 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class VirtualMachineExtensionsOperations(object): + """VirtualMachineExtensionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _create_or_update_initial( + self, + resource_group_name, # type: str + vm_name, # type: str + vm_extension_name, # type: str + extension_parameters, # type: "_models.VirtualMachineExtension" + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualMachineExtension" + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'vmExtensionName': self._serialize.url("vm_extension_name", vm_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(extension_parameters, 'VirtualMachineExtension') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineExtension', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VirtualMachineExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + vm_name, # type: str + vm_extension_name, # type: str + extension_parameters, # type: "_models.VirtualMachineExtension" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.VirtualMachineExtension"] + """The operation to create or update the extension. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine where the extension should be created or + updated. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. + :type extension_parameters: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtension + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 VirtualMachineExtension or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + extension_parameters=extension_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualMachineExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'vmExtensionName': self._serialize.url("vm_extension_name", vm_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + vm_name, # type: str + vm_extension_name, # type: str + extension_parameters, # type: "_models.VirtualMachineExtensionUpdate" + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualMachineExtension" + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'vmExtensionName': self._serialize.url("vm_extension_name", vm_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(extension_parameters, 'VirtualMachineExtensionUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + vm_name, # type: str + vm_extension_name, # type: str + extension_parameters, # type: "_models.VirtualMachineExtensionUpdate" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.VirtualMachineExtension"] + """The operation to update the extension. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine where the extension should be updated. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. + :type extension_parameters: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtensionUpdate + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 VirtualMachineExtension or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + extension_parameters=extension_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualMachineExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'vmExtensionName': self._serialize.url("vm_extension_name", vm_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + vm_name, # type: str + vm_extension_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'vmExtensionName': self._serialize.url("vm_extension_name", vm_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + vm_name, # type: str + vm_extension_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """The operation to delete the extension. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine where the extension should be deleted. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. + :type vm_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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + vm_extension_name=vm_extension_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'vmExtensionName': self._serialize.url("vm_extension_name", vm_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + vm_name, # type: str + vm_extension_name, # type: str + expand=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualMachineExtension" + """The operation to get the extension. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine containing the extension. + :type vm_name: str + :param vm_extension_name: The name of the virtual machine extension. + :type vm_extension_name: str + :param expand: The expand expression to apply on the operation. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineExtension, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtension + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtension"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'vmExtensionName': self._serialize.url("vm_extension_name", vm_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + vm_name, # type: str + expand=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualMachineExtensionsListResult" + """The operation to get all extensions of a Virtual Machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine containing the extension. + :type vm_name: str + :param expand: The expand expression to apply on the operation. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineExtensionsListResult, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineExtensionsListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineExtensionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineExtensionsListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_images_edge_zone_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_images_edge_zone_operations.py new file mode 100644 index 0000000000000..243d9782081ee --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_images_edge_zone_operations.py @@ -0,0 +1,399 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class VirtualMachineImagesEdgeZoneOperations(object): + """VirtualMachineImagesEdgeZoneOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + location, # type: str + edge_zone, # type: str + publisher_name, # type: str + offer, # type: str + skus, # type: str + version, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualMachineImage" + """Gets a virtual machine image in an edge zone. + + :param location: The name of a supported Azure region. + :type location: str + :param edge_zone: The name of the edge zone. + :type edge_zone: str + :param publisher_name: A valid image publisher. + :type publisher_name: str + :param offer: A valid image publisher offer. + :type offer: str + :param skus: A valid image SKU. + :type skus: str + :param version: A valid image SKU version. + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineImage, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineImage + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineImage"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'edgeZone': self._serialize.url("edge_zone", edge_zone, 'str'), + 'publisherName': self._serialize.url("publisher_name", publisher_name, 'str'), + 'offer': self._serialize.url("offer", offer, 'str'), + 'skus': self._serialize.url("skus", skus, 'str'), + 'version': self._serialize.url("version", version, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineImage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}'} # type: ignore + + def list( + self, + location, # type: str + edge_zone, # type: str + publisher_name, # type: str + offer, # type: str + skus, # type: str + expand=None, # type: Optional[str] + top=None, # type: Optional[int] + orderby=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> List["_models.VirtualMachineImageResource"] + """Gets a list of all virtual machine image versions for the specified location, edge zone, + publisher, offer, and SKU. + + :param location: The name of a supported Azure region. + :type location: str + :param edge_zone: The name of the edge zone. + :type edge_zone: str + :param publisher_name: A valid image publisher. + :type publisher_name: str + :param offer: A valid image publisher offer. + :type offer: str + :param skus: A valid image SKU. + :type skus: str + :param expand: The expand expression to apply on the operation. + :type expand: str + :param top: An integer value specifying the number of images to return that matches supplied + values. + :type top: int + :param orderby: Specifies the order of the results returned. Formatted as an OData query. + :type orderby: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VirtualMachineImageResource, or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineImageResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineImageResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'edgeZone': self._serialize.url("edge_zone", edge_zone, 'str'), + 'publisherName': self._serialize.url("publisher_name", publisher_name, 'str'), + 'offer': self._serialize.url("offer", offer, 'str'), + 'skus': self._serialize.url("skus", skus, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineImageResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions'} # type: ignore + + def list_offers( + self, + location, # type: str + edge_zone, # type: str + publisher_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["_models.VirtualMachineImageResource"] + """Gets a list of virtual machine image offers for the specified location, edge zone and + publisher. + + :param location: The name of a supported Azure region. + :type location: str + :param edge_zone: The name of the edge zone. + :type edge_zone: str + :param publisher_name: A valid image publisher. + :type publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VirtualMachineImageResource, or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineImageResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineImageResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.list_offers.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'edgeZone': self._serialize.url("edge_zone", edge_zone, 'str'), + 'publisherName': self._serialize.url("publisher_name", publisher_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineImageResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_offers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers'} # type: ignore + + def list_publishers( + self, + location, # type: str + edge_zone, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["_models.VirtualMachineImageResource"] + """Gets a list of virtual machine image publishers for the specified Azure location and edge zone. + + :param location: The name of a supported Azure region. + :type location: str + :param edge_zone: The name of the edge zone. + :type edge_zone: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VirtualMachineImageResource, or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineImageResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineImageResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.list_publishers.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'edgeZone': self._serialize.url("edge_zone", edge_zone, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineImageResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers'} # type: ignore + + def list_skus( + self, + location, # type: str + edge_zone, # type: str + publisher_name, # type: str + offer, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["_models.VirtualMachineImageResource"] + """Gets a list of virtual machine image SKUs for the specified location, edge zone, publisher, and + offer. + + :param location: The name of a supported Azure region. + :type location: str + :param edge_zone: The name of the edge zone. + :type edge_zone: str + :param publisher_name: A valid image publisher. + :type publisher_name: str + :param offer: A valid image publisher offer. + :type offer: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VirtualMachineImageResource, or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineImageResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineImageResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.list_skus.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'edgeZone': self._serialize.url("edge_zone", edge_zone, 'str'), + 'publisherName': self._serialize.url("publisher_name", publisher_name, 'str'), + 'offer': self._serialize.url("offer", offer, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineImageResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_skus.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/edgeZones/{edgeZone}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_images_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_images_operations.py new file mode 100644 index 0000000000000..f1151606ab3f1 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_images_operations.py @@ -0,0 +1,376 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class VirtualMachineImagesOperations(object): + """VirtualMachineImagesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + location, # type: str + publisher_name, # type: str + offer, # type: str + skus, # type: str + version, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualMachineImage" + """Gets a virtual machine image. + + :param location: The name of a supported Azure region. + :type location: str + :param publisher_name: A valid image publisher. + :type publisher_name: str + :param offer: A valid image publisher offer. + :type offer: str + :param skus: A valid image SKU. + :type skus: str + :param version: A valid image SKU version. + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineImage, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineImage + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineImage"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'publisherName': self._serialize.url("publisher_name", publisher_name, 'str'), + 'offer': self._serialize.url("offer", offer, 'str'), + 'skus': self._serialize.url("skus", skus, 'str'), + 'version': self._serialize.url("version", version, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineImage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}'} # type: ignore + + def list( + self, + location, # type: str + publisher_name, # type: str + offer, # type: str + skus, # type: str + expand=None, # type: Optional[str] + top=None, # type: Optional[int] + orderby=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> List["_models.VirtualMachineImageResource"] + """Gets a list of all virtual machine image versions for the specified location, publisher, offer, + and SKU. + + :param location: The name of a supported Azure region. + :type location: str + :param publisher_name: A valid image publisher. + :type publisher_name: str + :param offer: A valid image publisher offer. + :type offer: str + :param skus: A valid image SKU. + :type skus: str + :param expand: The expand expression to apply on the operation. + :type expand: str + :param top: + :type top: int + :param orderby: + :type orderby: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VirtualMachineImageResource, or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineImageResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineImageResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'publisherName': self._serialize.url("publisher_name", publisher_name, 'str'), + 'offer': self._serialize.url("offer", offer, 'str'), + 'skus': self._serialize.url("skus", skus, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + if orderby is not None: + query_parameters['$orderby'] = self._serialize.query("orderby", orderby, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineImageResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions'} # type: ignore + + def list_offers( + self, + location, # type: str + publisher_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["_models.VirtualMachineImageResource"] + """Gets a list of virtual machine image offers for the specified location and publisher. + + :param location: The name of a supported Azure region. + :type location: str + :param publisher_name: A valid image publisher. + :type publisher_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VirtualMachineImageResource, or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineImageResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineImageResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.list_offers.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'publisherName': self._serialize.url("publisher_name", publisher_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineImageResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_offers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers'} # type: ignore + + def list_publishers( + self, + location, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["_models.VirtualMachineImageResource"] + """Gets a list of virtual machine image publishers for the specified Azure location. + + :param location: The name of a supported Azure region. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VirtualMachineImageResource, or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineImageResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineImageResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.list_publishers.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineImageResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_publishers.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers'} # type: ignore + + def list_skus( + self, + location, # type: str + publisher_name, # type: str + offer, # type: str + **kwargs # type: Any + ): + # type: (...) -> List["_models.VirtualMachineImageResource"] + """Gets a list of virtual machine image SKUs for the specified location, publisher, and offer. + + :param location: The name of a supported Azure region. + :type location: str + :param publisher_name: A valid image publisher. + :type publisher_name: str + :param offer: A valid image publisher offer. + :type offer: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of VirtualMachineImageResource, or the result of cls(response) + :rtype: list[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineImageResource] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.VirtualMachineImageResource"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.list_skus.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str'), + 'publisherName': self._serialize.url("publisher_name", publisher_name, 'str'), + 'offer': self._serialize.url("offer", offer, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[VirtualMachineImageResource]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_skus.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_run_commands_operations.py new file mode 100644 index 0000000000000..f7280d1f0533e --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_run_commands_operations.py @@ -0,0 +1,714 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class VirtualMachineRunCommandsOperations(object): + """VirtualMachineRunCommandsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + location, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.RunCommandListResult"] + """Lists all available run commands for a subscription in a location. + + :param location: The location upon which run commands is queried. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RunCommandListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.RunCommandListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json, text/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('RunCommandListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands'} # type: ignore + + def get( + self, + location, # type: str + command_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.RunCommandDocument" + """Gets specific run command for a subscription in a location. + + :param location: The location upon which run commands is queried. + :type location: str + :param command_id: The command id. + :type command_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RunCommandDocument, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.RunCommandDocument + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandDocument"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json, text/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + 'commandId': self._serialize.url("command_id", command_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RunCommandDocument', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/runCommands/{commandId}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + vm_name, # type: str + run_command_name, # type: str + run_command, # type: "_models.VirtualMachineRunCommand" + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualMachineRunCommand" + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json, text/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'runCommandName': self._serialize.url("run_command_name", run_command_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(run_command, 'VirtualMachineRunCommand') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + vm_name, # type: str + run_command_name, # type: str + run_command, # type: "_models.VirtualMachineRunCommand" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.VirtualMachineRunCommand"] + """The operation to create or update the run command. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine where the run command should be created or + updated. + :type vm_name: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_name: str + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + :type run_command: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommand + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 VirtualMachineRunCommand or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommand] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + run_command=run_command, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'runCommandName': self._serialize.url("run_command_name", run_command_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + vm_name, # type: str + run_command_name, # type: str + run_command, # type: "_models.VirtualMachineRunCommandUpdate" + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualMachineRunCommand" + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json, text/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'runCommandName': self._serialize.url("run_command_name", run_command_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + vm_name, # type: str + run_command_name, # type: str + run_command, # type: "_models.VirtualMachineRunCommandUpdate" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.VirtualMachineRunCommand"] + """The operation to update the run command. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine where the run command should be updated. + :type vm_name: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_name: str + :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. + :type run_command: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommandUpdate + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 VirtualMachineRunCommand or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommand] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + run_command=run_command, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'runCommandName': self._serialize.url("run_command_name", run_command_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + vm_name, # type: str + run_command_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json, text/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'runCommandName': self._serialize.url("run_command_name", run_command_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + vm_name, # type: str + run_command_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """The operation to delete the run command. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine where the run command should be deleted. + :type vm_name: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + run_command_name=run_command_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'runCommandName': self._serialize.url("run_command_name", run_command_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + + def get_by_virtual_machine( + self, + resource_group_name, # type: str + vm_name, # type: str + run_command_name, # type: str + expand=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualMachineRunCommand" + """The operation to get the run command. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine containing the run command. + :type vm_name: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_name: str + :param expand: The expand expression to apply on the operation. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineRunCommand, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommand + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json, text/json" + + # Construct URL + url = self.get_by_virtual_machine.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'runCommandName': self._serialize.url("run_command_name", run_command_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_by_virtual_machine.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands/{runCommandName}'} # type: ignore + + def list_by_virtual_machine( + self, + resource_group_name, # type: str + vm_name, # type: str + expand=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.VirtualMachineRunCommandsListResult"] + """The operation to get all run commands of a Virtual Machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine containing the run command. + :type vm_name: str + :param expand: The expand expression to apply on the operation. + :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 VirtualMachineRunCommandsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommandsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json, text/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_virtual_machine.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('VirtualMachineRunCommandsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_virtual_machine.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommands'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_extensions_operations.py new file mode 100644 index 0000000000000..f6cfb36319804 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_extensions_operations.py @@ -0,0 +1,583 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class VirtualMachineScaleSetExtensionsOperations(object): + """VirtualMachineScaleSetExtensionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _create_or_update_initial( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + vmss_extension_name, # type: str + extension_parameters, # type: "_models.VirtualMachineScaleSetExtension" + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualMachineScaleSetExtension" + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'vmssExtensionName': self._serialize.url("vmss_extension_name", vmss_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtension') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineScaleSetExtension', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VirtualMachineScaleSetExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + vmss_extension_name, # type: str + extension_parameters, # type: "_models.VirtualMachineScaleSetExtension" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.VirtualMachineScaleSetExtension"] + """The operation to create or update an extension. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set where the extension should be create or + updated. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. + :type vmss_extension_name: str + :param extension_parameters: Parameters supplied to the Create VM scale set Extension + operation. + :type extension_parameters: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetExtension + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 VirtualMachineScaleSetExtension or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + extension_parameters=extension_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualMachineScaleSetExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'vmssExtensionName': self._serialize.url("vmss_extension_name", vmss_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + vmss_extension_name, # type: str + extension_parameters, # type: "_models.VirtualMachineScaleSetExtensionUpdate" + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualMachineScaleSetExtension" + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'vmssExtensionName': self._serialize.url("vmss_extension_name", vmss_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetExtensionUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineScaleSetExtension', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VirtualMachineScaleSetExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + vmss_extension_name, # type: str + extension_parameters, # type: "_models.VirtualMachineScaleSetExtensionUpdate" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.VirtualMachineScaleSetExtension"] + """The operation to update an extension. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set where the extension should be updated. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. + :type vmss_extension_name: str + :param extension_parameters: Parameters supplied to the Update VM scale set Extension + operation. + :type extension_parameters: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetExtensionUpdate + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 VirtualMachineScaleSetExtension or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + extension_parameters=extension_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualMachineScaleSetExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'vmssExtensionName': self._serialize.url("vmss_extension_name", vmss_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + vmss_extension_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'vmssExtensionName': self._serialize.url("vmss_extension_name", vmss_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + vmss_extension_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """The operation to delete the extension. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set where the extension should be deleted. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. + :type vmss_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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vmss_extension_name=vmss_extension_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'vmssExtensionName': self._serialize.url("vmss_extension_name", vmss_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + vmss_extension_name, # type: str + expand=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualMachineScaleSetExtension" + """The operation to get the extension. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set containing the extension. + :type vm_scale_set_name: str + :param vmss_extension_name: The name of the VM scale set extension. + :type vmss_extension_name: str + :param expand: The expand expression to apply on the operation. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineScaleSetExtension, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetExtension + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtension"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'vmssExtensionName': self._serialize.url("vmss_extension_name", vmss_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineScaleSetExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions/{vmssExtensionName}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.VirtualMachineScaleSetExtensionListResult"] + """Gets a list of all extensions in a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set containing the extension. + :type vm_scale_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineScaleSetExtensionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetExtensionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetExtensionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('VirtualMachineScaleSetExtensionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensions'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py new file mode 100644 index 0000000000000..a0946fe490a67 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_rolling_upgrades_operations.py @@ -0,0 +1,434 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class VirtualMachineScaleSetRollingUpgradesOperations(object): + """VirtualMachineScaleSetRollingUpgradesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _cancel_initial( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._cancel_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel'} # type: ignore + + def begin_cancel( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Cancels the current virtual machine scale set rolling upgrade. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._cancel_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_cancel.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/cancel'} # type: ignore + + def _start_os_upgrade_initial( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._start_os_upgrade_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_os_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade'} # type: ignore + + def begin_start_os_upgrade( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Starts a rolling upgrade to move all virtual machine scale set instances to the latest + available Platform Image OS version. Instances which are already running the latest available + OS version are not affected. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._start_os_upgrade_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start_os_upgrade.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osRollingUpgrade'} # type: ignore + + def _start_extension_upgrade_initial( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._start_extension_upgrade_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_extension_upgrade_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade'} # type: ignore + + def begin_start_extension_upgrade( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Starts a rolling upgrade to move all extensions for all virtual machine scale set instances to + the latest available extension version. Instances which are already running the latest + extension versions are not affected. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._start_extension_upgrade_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start_extension_upgrade.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/extensionRollingUpgrade'} # type: ignore + + def get_latest( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.RollingUpgradeStatusInfo" + """Gets the status of the latest virtual machine scale set rolling upgrade. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RollingUpgradeStatusInfo, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.RollingUpgradeStatusInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RollingUpgradeStatusInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get_latest.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RollingUpgradeStatusInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_latest.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/rollingUpgrades/latest'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py new file mode 100644 index 0000000000000..93ad715823ae8 --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_vm_extensions_operations.py @@ -0,0 +1,597 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class VirtualMachineScaleSetVMExtensionsOperations(object): + """VirtualMachineScaleSetVMExtensionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _create_or_update_initial( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + vm_extension_name, # type: str + extension_parameters, # type: "_models.VirtualMachineScaleSetVMExtension" + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualMachineScaleSetVMExtension" + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'vmExtensionName': self._serialize.url("vm_extension_name", vm_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtension') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineScaleSetVMExtension', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VirtualMachineScaleSetVMExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + vm_extension_name, # type: str + extension_parameters, # type: "_models.VirtualMachineScaleSetVMExtension" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.VirtualMachineScaleSetVMExtension"] + """The operation to create or update the VMSS VM extension. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Create Virtual Machine Extension + operation. + :type extension_parameters: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMExtension + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 VirtualMachineScaleSetVMExtension or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, + extension_parameters=extension_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualMachineScaleSetVMExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'vmExtensionName': self._serialize.url("vm_extension_name", vm_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + vm_extension_name, # type: str + extension_parameters, # type: "_models.VirtualMachineScaleSetVMExtensionUpdate" + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualMachineScaleSetVMExtension" + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'vmExtensionName': self._serialize.url("vm_extension_name", vm_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(extension_parameters, 'VirtualMachineScaleSetVMExtensionUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineScaleSetVMExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + vm_extension_name, # type: str + extension_parameters, # type: "_models.VirtualMachineScaleSetVMExtensionUpdate" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.VirtualMachineScaleSetVMExtension"] + """The operation to update the VMSS VM extension. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. + :type vm_extension_name: str + :param extension_parameters: Parameters supplied to the Update Virtual Machine Extension + operation. + :type extension_parameters: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMExtensionUpdate + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 VirtualMachineScaleSetVMExtension or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, + extension_parameters=extension_parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualMachineScaleSetVMExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'vmExtensionName': self._serialize.url("vm_extension_name", vm_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + vm_extension_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'vmExtensionName': self._serialize.url("vm_extension_name", vm_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + vm_extension_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """The operation to delete the VMSS VM extension. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. + :type vm_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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_extension_name=vm_extension_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'vmExtensionName': self._serialize.url("vm_extension_name", vm_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + vm_extension_name, # type: str + expand=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualMachineScaleSetVMExtension" + """The operation to get the VMSS VM extension. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param vm_extension_name: The name of the virtual machine extension. + :type vm_extension_name: str + :param expand: The expand expression to apply on the operation. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineScaleSetVMExtension, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMExtension + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtension"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'vmExtensionName': self._serialize.url("vm_extension_name", vm_extension_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineScaleSetVMExtension', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions/{vmExtensionName}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + expand=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualMachineScaleSetVMExtensionsListResult" + """The operation to get all extensions of an instance in Virtual Machine Scaleset. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param expand: The expand expression to apply on the operation. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineScaleSetVMExtensionsListResult, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMExtensionsListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMExtensionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineScaleSetVMExtensionsListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/extensions'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py new file mode 100644 index 0000000000000..d4283c00b6e6f --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_vm_run_commands_operations.py @@ -0,0 +1,612 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class VirtualMachineScaleSetVMRunCommandsOperations(object): + """VirtualMachineScaleSetVMRunCommandsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _create_or_update_initial( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + run_command_name, # type: str + run_command, # type: "_models.VirtualMachineRunCommand" + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualMachineRunCommand" + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json, text/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'runCommandName': self._serialize.url("run_command_name", run_command_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(run_command, 'VirtualMachineRunCommand') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + run_command_name, # type: str + run_command, # type: "_models.VirtualMachineRunCommand" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.VirtualMachineRunCommand"] + """The operation to create or update the VMSS VM run command. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_name: str + :param run_command: Parameters supplied to the Create Virtual Machine RunCommand operation. + :type run_command: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommand + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 VirtualMachineRunCommand or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommand] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, + run_command=run_command, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'runCommandName': self._serialize.url("run_command_name", run_command_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + run_command_name, # type: str + run_command, # type: "_models.VirtualMachineRunCommandUpdate" + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualMachineRunCommand" + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json, text/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'runCommandName': self._serialize.url("run_command_name", run_command_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(run_command, 'VirtualMachineRunCommandUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + run_command_name, # type: str + run_command, # type: "_models.VirtualMachineRunCommandUpdate" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.VirtualMachineRunCommand"] + """The operation to update the VMSS VM run command. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_name: str + :param run_command: Parameters supplied to the Update Virtual Machine RunCommand operation. + :type run_command: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommandUpdate + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 VirtualMachineRunCommand or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommand] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, + run_command=run_command, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'runCommandName': self._serialize.url("run_command_name", run_command_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + run_command_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json, text/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'runCommandName': self._serialize.url("run_command_name", run_command_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + run_command_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """The operation to delete the VMSS VM run command. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + run_command_name=run_command_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'runCommandName': self._serialize.url("run_command_name", run_command_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + run_command_name, # type: str + expand=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualMachineRunCommand" + """The operation to get the VMSS VM run command. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param run_command_name: The name of the virtual machine run command. + :type run_command_name: str + :param expand: The expand expression to apply on the operation. + :type expand: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineRunCommand, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommand + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommand"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json, text/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'runCommandName': self._serialize.url("run_command_name", run_command_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineRunCommand', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands/{runCommandName}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + expand=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.VirtualMachineRunCommandsListResult"] + """The operation to get all run commands of an instance in Virtual Machine Scaleset. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param expand: The expand expression to apply on the operation. + :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 VirtualMachineRunCommandsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineRunCommandsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineRunCommandsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json, text/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('VirtualMachineRunCommandsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/runCommands'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_vms_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_vms_operations.py new file mode 100644 index 0000000000000..f51bf166732ac --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_set_vms_operations.py @@ -0,0 +1,1745 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class VirtualMachineScaleSetVMsOperations(object): + """VirtualMachineScaleSetVMsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _reimage_initial( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + vm_scale_set_vm_reimage_input=None, # type: Optional["_models.VirtualMachineScaleSetVMReimageParameters"] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._reimage_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if vm_scale_set_vm_reimage_input is not None: + body_content = self._serialize.body(vm_scale_set_vm_reimage_input, 'VirtualMachineScaleSetVMReimageParameters') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + + def begin_reimage( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + vm_scale_set_vm_reimage_input=None, # type: Optional["_models.VirtualMachineScaleSetVMReimageParameters"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param vm_scale_set_vm_reimage_input: Parameters for the Reimaging Virtual machine in ScaleSet. + :type vm_scale_set_vm_reimage_input: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMReimageParameters + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._reimage_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + vm_scale_set_vm_reimage_input=vm_scale_set_vm_reimage_input, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'} # type: ignore + + def _reimage_all_initial( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._reimage_all_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall'} # type: ignore + + def begin_reimage_all( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Allows you to re-image all the disks ( including data disks ) in the a VM scale set instance. + This operation is only supported for managed disks. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: 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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._reimage_all_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_reimage_all.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimageall'} # type: ignore + + def _deallocate_initial( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._deallocate_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + + def begin_deallocate( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and + releases the compute resources it uses. You are not billed for the compute resources of this + virtual machine once it is deallocated. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: 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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._deallocate_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_deallocate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + parameters, # type: "_models.VirtualMachineScaleSetVM" + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualMachineScaleSetVM" + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VirtualMachineScaleSetVM') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineScaleSetVM', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('VirtualMachineScaleSetVM', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + parameters, # type: "_models.VirtualMachineScaleSetVM" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.VirtualMachineScaleSetVM"] + """Updates a virtual machine of a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set where the extension should be create or + updated. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param parameters: Parameters supplied to the Update Virtual Machine Scale Sets VM operation. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVM + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 VirtualMachineScaleSetVM or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVM] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualMachineScaleSetVM', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + force_deletion=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if force_deletion is not None: + query_parameters['forceDeletion'] = self._serialize.query("force_deletion", force_deletion, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + force_deletion=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a virtual machine from a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param force_deletion: Optional parameter to force delete a virtual machine from a VM scale + set. (Feature in Preview). + :type force_deletion: 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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + force_deletion=force_deletion, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + expand=None, # type: Optional[Union[str, "_models.InstanceViewTypes"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualMachineScaleSetVM" + """Gets a virtual machine from a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param expand: The expand expression to apply on the operation. + :type expand: str or ~azure.mgmt.compute.v2021_03_01.models.InstanceViewTypes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineScaleSetVM, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVM + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVM"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineScaleSetVM', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'} # type: ignore + + def get_instance_view( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualMachineScaleSetVMInstanceView" + """Gets the status of a virtual machine from a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineScaleSetVMInstanceView, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMInstanceView + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMInstanceView"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get_instance_view.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineScaleSetVMInstanceView', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView'} # type: ignore + + def list( + self, + resource_group_name, # type: str + virtual_machine_scale_set_name, # type: str + filter=None, # type: Optional[str] + select=None, # type: Optional[str] + expand=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.VirtualMachineScaleSetVMListResult"] + """Gets a list of all virtual machines in a VM scale sets. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param virtual_machine_scale_set_name: The name of the VM scale set. + :type virtual_machine_scale_set_name: str + :param filter: The filter to apply to the operation. Allowed values are + 'startswith(instanceView/statuses/code, 'PowerState') eq true', 'properties/latestModelApplied + eq true', 'properties/latestModelApplied eq false'. + :type filter: str + :param select: The list parameters. Allowed values are 'instanceView', 'instanceView/statuses'. + :type select: str + :param expand: The expand expression to apply to the operation. Allowed values are + 'instanceView'. + :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 VirtualMachineScaleSetVMListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetVMListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'virtualMachineScaleSetName': self._serialize.url("virtual_machine_scale_set_name", virtual_machine_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if select is not None: + query_parameters['$select'] = self._serialize.query("select", select, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('VirtualMachineScaleSetVMListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines'} # type: ignore + + def _power_off_initial( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + skip_shutdown=False, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._power_off_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if skip_shutdown is not None: + query_parameters['skipShutdown'] = self._serialize.query("skip_shutdown", skip_shutdown, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + + def begin_power_off( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + skip_shutdown=False, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Power off (stop) a virtual machine in a VM scale set. Note that resources are still attached + and you are getting charged for the resources. Instead, use deallocate to release resources and + avoid charges. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this + flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this + flag is false if not specified. + :type skip_shutdown: 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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._power_off_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + skip_shutdown=skip_shutdown, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_power_off.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'} # type: ignore + + def _restart_initial( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._restart_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + + def begin_restart( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Restarts a virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: 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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._restart_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'} # type: ignore + + def _start_initial( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._start_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + + def begin_start( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Starts a virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: 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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._start_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'} # type: ignore + + def _redeploy_initial( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._redeploy_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy'} # type: ignore + + def begin_redeploy( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Shuts down the virtual machine in the virtual machine scale set, moves it to a new node, and + powers it back on. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: 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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._redeploy_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_redeploy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy'} # type: ignore + + def retrieve_boot_diagnostics_data( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + sas_uri_expiration_time_in_minutes=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> "_models.RetrieveBootDiagnosticsDataResult" + """The operation to retrieve SAS URIs of boot diagnostic logs for a virtual machine in a VM scale + set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param sas_uri_expiration_time_in_minutes: Expiration duration in minutes for the SAS URIs with + a value between 1 to 1440 minutes. :code:`
    `:code:`
    `NOTE: If not specified, SAS URIs + will be generated with a default expiration duration of 120 minutes. + :type sas_uri_expiration_time_in_minutes: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RetrieveBootDiagnosticsDataResult, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.RetrieveBootDiagnosticsDataResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RetrieveBootDiagnosticsDataResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.retrieve_boot_diagnostics_data.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if sas_uri_expiration_time_in_minutes is not None: + query_parameters['sasUriExpirationTimeInMinutes'] = self._serialize.query("sas_uri_expiration_time_in_minutes", sas_uri_expiration_time_in_minutes, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RetrieveBootDiagnosticsDataResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + retrieve_boot_diagnostics_data.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/retrieveBootDiagnosticsData'} # type: ignore + + def _perform_maintenance_initial( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._perform_maintenance_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance'} # type: ignore + + def begin_perform_maintenance( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Performs maintenance on a virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: 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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._perform_maintenance_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_perform_maintenance.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance'} # type: ignore + + def simulate_eviction( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """The operation to simulate the eviction of spot virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: 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 + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self.simulate_eviction.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + simulate_eviction.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualMachines/{instanceId}/simulateEviction'} # type: ignore + + def _run_command_initial( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + parameters, # type: "_models.RunCommandInput" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.RunCommandResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json, text/json" + + # Construct URL + url = self._run_command_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RunCommandInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RunCommandResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _run_command_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand'} # type: ignore + + def begin_run_command( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + instance_id, # type: str + parameters, # type: "_models.RunCommandInput" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.RunCommandResult"] + """Run command on a virtual machine in a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param instance_id: The instance ID of the virtual machine. + :type instance_id: str + :param parameters: Parameters supplied to the Run command operation. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.RunCommandInput + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 RunCommandResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._run_command_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + instance_id=instance_id, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('RunCommandResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'instanceId': self._serialize.url("instance_id", instance_id, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_run_command.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/runCommand'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_sets_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_sets_operations.py new file mode 100644 index 0000000000000..6033783a7cb6b --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_scale_sets_operations.py @@ -0,0 +1,2381 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class VirtualMachineScaleSetsOperations(object): + """VirtualMachineScaleSetsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_location( + self, + location, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.VirtualMachineScaleSetListResult"] + """Gets all the VM scale sets under the specified subscription for the specified location. + + :param location: The location for which VM scale sets under the subscription are queried. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineScaleSetListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_location.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_location.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachineScaleSets'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + parameters, # type: "_models.VirtualMachineScaleSet" + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualMachineScaleSet" + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VirtualMachineScaleSet') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineScaleSet', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VirtualMachineScaleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + parameters, # type: "_models.VirtualMachineScaleSet" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.VirtualMachineScaleSet"] + """Create or update a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set to create or update. + :type vm_scale_set_name: str + :param parameters: The scale set object. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSet + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 VirtualMachineScaleSet or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualMachineScaleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + parameters, # type: "_models.VirtualMachineScaleSetUpdate" + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualMachineScaleSet" + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VirtualMachineScaleSetUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineScaleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + parameters, # type: "_models.VirtualMachineScaleSetUpdate" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.VirtualMachineScaleSet"] + """Update a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set to create or update. + :type vm_scale_set_name: str + :param parameters: The scale set object. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetUpdate + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 VirtualMachineScaleSet or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualMachineScaleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + force_deletion=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if force_deletion is not None: + query_parameters['forceDeletion'] = self._serialize.query("force_deletion", force_deletion, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + force_deletion=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param force_deletion: Optional parameter to force delete a VM scale set. (Feature in Preview). + :type force_deletion: 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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + force_deletion=force_deletion, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + expand=None, # type: Optional[Union[str, "_models.ExpandTypesForGetVMScaleSets"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualMachineScaleSet" + """Display information about a virtual machine scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param expand: The expand expression to apply on the operation. + :type expand: str or ~azure.mgmt.compute.v2021_03_01.models.ExpandTypesForGetVMScaleSets + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineScaleSet, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSet + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSet"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineScaleSet', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'} # type: ignore + + def _deallocate_initial( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + vm_instance_i_ds=None, # type: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._deallocate_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if vm_instance_i_ds is not None: + body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + + def begin_deallocate( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + vm_instance_i_ds=None, # type: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and + releases the compute resources. You are not billed for the compute resources that this virtual + machine scale set deallocates. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :type vm_instance_i_ds: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._deallocate_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_deallocate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'} # type: ignore + + def _delete_instances_initial( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + vm_instance_i_ds, # type: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs" + force_deletion=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._delete_instances_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if force_deletion is not None: + query_parameters['forceDeletion'] = self._serialize.query("force_deletion", force_deletion, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + + def begin_delete_instances( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + vm_instance_i_ds, # type: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs" + force_deletion=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :type vm_instance_i_ds: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :param force_deletion: Optional parameter to force delete virtual machines from the VM scale + set. (Feature in Preview). + :type force_deletion: 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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_instances_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + force_deletion=force_deletion, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_instances.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'} # type: ignore + + def get_instance_view( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualMachineScaleSetInstanceView" + """Gets the status of a VM scale set instance. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineScaleSetInstanceView, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetInstanceView + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetInstanceView"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get_instance_view.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineScaleSetInstanceView', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView'} # type: ignore + + def list( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.VirtualMachineScaleSetListResult"] + """Gets a list of all VM scale sets under a resource group. + + :param resource_group_name: The name of the resource group. + :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 VirtualMachineScaleSetListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('VirtualMachineScaleSetListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + + def list_all( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.VirtualMachineScaleSetListWithLinkResult"] + """Gets a list of all VM Scale Sets in the subscription, regardless of the associated resource + group. Use nextLink property in the response to get the next page of VM Scale Sets. Do this + till nextLink is null to fetch all the VM Scale Sets. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineScaleSetListWithLinkResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetListWithLinkResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListWithLinkResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_all.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('VirtualMachineScaleSetListWithLinkResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets'} # type: ignore + + def list_skus( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.VirtualMachineScaleSetListSkusResult"] + """Gets a list of SKUs available for your VM scale set, including the minimum and maximum VM + instances allowed for each SKU. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineScaleSetListSkusResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetListSkusResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListSkusResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_skus.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('VirtualMachineScaleSetListSkusResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus'} # type: ignore + + def get_os_upgrade_history( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.VirtualMachineScaleSetListOSUpgradeHistory"] + """Gets list of OS upgrades on a VM scale set instance. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineScaleSetListOSUpgradeHistory or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetListOSUpgradeHistory] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineScaleSetListOSUpgradeHistory"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.get_os_upgrade_history.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('VirtualMachineScaleSetListOSUpgradeHistory', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + get_os_upgrade_history.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory'} # type: ignore + + def _power_off_initial( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + skip_shutdown=False, # type: Optional[bool] + vm_instance_i_ds=None, # type: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._power_off_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if skip_shutdown is not None: + query_parameters['skipShutdown'] = self._serialize.query("skip_shutdown", skip_shutdown, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if vm_instance_i_ds is not None: + body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + + def begin_power_off( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + skip_shutdown=False, # type: Optional[bool] + vm_instance_i_ds=None, # type: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still + attached and you are getting charged for the resources. Instead, use deallocate to release + resources and avoid charges. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this + flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this + flag is false if not specified. + :type skip_shutdown: bool + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :type vm_instance_i_ds: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._power_off_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + skip_shutdown=skip_shutdown, + vm_instance_i_ds=vm_instance_i_ds, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_power_off.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'} # type: ignore + + def _restart_initial( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + vm_instance_i_ds=None, # type: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._restart_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if vm_instance_i_ds is not None: + body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + + def begin_restart( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + vm_instance_i_ds=None, # type: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Restarts one or more virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :type vm_instance_i_ds: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._restart_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'} # type: ignore + + def _start_initial( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + vm_instance_i_ds=None, # type: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._start_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if vm_instance_i_ds is not None: + body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + + def begin_start( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + vm_instance_i_ds=None, # type: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Starts one or more virtual machines in a VM scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :type vm_instance_i_ds: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._start_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'} # type: ignore + + def _redeploy_initial( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + vm_instance_i_ds=None, # type: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._redeploy_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if vm_instance_i_ds is not None: + body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy'} # type: ignore + + def begin_redeploy( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + vm_instance_i_ds=None, # type: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Shuts down all the virtual machines in the virtual machine scale set, moves them to a new node, + and powers them back on. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :type vm_instance_i_ds: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._redeploy_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_redeploy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy'} # type: ignore + + def _perform_maintenance_initial( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + vm_instance_i_ds=None, # type: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._perform_maintenance_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if vm_instance_i_ds is not None: + body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance'} # type: ignore + + def begin_perform_maintenance( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + vm_instance_i_ds=None, # type: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Perform maintenance on one or more virtual machines in a VM scale set. Operation on instances + which are not eligible for perform maintenance will be failed. Please refer to best practices + for more details: https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual- + machine-scale-sets-maintenance-notifications. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :type vm_instance_i_ds: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._perform_maintenance_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_perform_maintenance.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance'} # type: ignore + + def _update_instances_initial( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + vm_instance_i_ds, # type: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._update_instances_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceRequiredIDs') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _update_instances_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + + def begin_update_instances( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + vm_instance_i_ds, # type: "_models.VirtualMachineScaleSetVMInstanceRequiredIDs" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :type vm_instance_i_ds: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMInstanceRequiredIDs + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_instances_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update_instances.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'} # type: ignore + + def _reimage_initial( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + vm_scale_set_reimage_input=None, # type: Optional["_models.VirtualMachineScaleSetReimageParameters"] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._reimage_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if vm_scale_set_reimage_input is not None: + body_content = self._serialize.body(vm_scale_set_reimage_input, 'VirtualMachineScaleSetReimageParameters') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + + def begin_reimage( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + vm_scale_set_reimage_input=None, # type: Optional["_models.VirtualMachineScaleSetReimageParameters"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Reimages (upgrade the operating system) one or more virtual machines in a VM scale set which + don't have a ephemeral OS disk, for virtual machines who have a ephemeral OS disk the virtual + machine is reset to initial state. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param vm_scale_set_reimage_input: Parameters for Reimaging VM ScaleSet. + :type vm_scale_set_reimage_input: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetReimageParameters + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._reimage_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_scale_set_reimage_input=vm_scale_set_reimage_input, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'} # type: ignore + + def _reimage_all_initial( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + vm_instance_i_ds=None, # type: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._reimage_all_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if vm_instance_i_ds is not None: + body_content = self._serialize.body(vm_instance_i_ds, 'VirtualMachineScaleSetVMInstanceIDs') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reimage_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall'} # type: ignore + + def begin_reimage_all( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + vm_instance_i_ds=None, # type: Optional["_models.VirtualMachineScaleSetVMInstanceIDs"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Reimages all the disks ( including data disks ) in the virtual machines in a VM scale set. This + operation is only supported for managed disks. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param vm_instance_i_ds: A list of virtual machine instance IDs from the VM scale set. + :type vm_instance_i_ds: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineScaleSetVMInstanceIDs + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._reimage_all_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + vm_instance_i_ds=vm_instance_i_ds, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_reimage_all.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimageall'} # type: ignore + + def force_recovery_service_fabric_platform_update_domain_walk( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + platform_update_domain, # type: int + **kwargs # type: Any + ): + # type: (...) -> "_models.RecoveryWalkResponse" + """Manual platform update domain walk to update virtual machines in a service fabric virtual + machine scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the VM scale set. + :type vm_scale_set_name: str + :param platform_update_domain: The platform update domain for which a manual recovery walk is + requested. + :type platform_update_domain: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RecoveryWalkResponse, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.RecoveryWalkResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryWalkResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.force_recovery_service_fabric_platform_update_domain_walk.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + query_parameters['platformUpdateDomain'] = self._serialize.query("platform_update_domain", platform_update_domain, 'int') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RecoveryWalkResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + force_recovery_service_fabric_platform_update_domain_walk.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/forceRecoveryServiceFabricPlatformUpdateDomainWalk'} # type: ignore + + def convert_to_single_placement_group( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + parameters, # type: "_models.VMScaleSetConvertToSinglePlacementGroupInput" + **kwargs # type: Any + ): + # type: (...) -> None + """Converts SinglePlacementGroup property to false for a existing virtual machine scale set. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the virtual machine scale set to create or update. + :type vm_scale_set_name: str + :param parameters: The input object for ConvertToSinglePlacementGroup API. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.VMScaleSetConvertToSinglePlacementGroupInput + :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 + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.convert_to_single_placement_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VMScaleSetConvertToSinglePlacementGroupInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + convert_to_single_placement_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/convertToSinglePlacementGroup'} # type: ignore + + def _set_orchestration_service_state_initial( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + parameters, # type: "_models.OrchestrationServiceStateInput" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._set_orchestration_service_state_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'OrchestrationServiceStateInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _set_orchestration_service_state_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState'} # type: ignore + + def begin_set_orchestration_service_state( + self, + resource_group_name, # type: str + vm_scale_set_name, # type: str + parameters, # type: "_models.OrchestrationServiceStateInput" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Changes ServiceState property for a given service. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_scale_set_name: The name of the virtual machine scale set to create or update. + :type vm_scale_set_name: str + :param parameters: The input object for SetOrchestrationServiceState API. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.OrchestrationServiceStateInput + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._set_orchestration_service_state_initial( + resource_group_name=resource_group_name, + vm_scale_set_name=vm_scale_set_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmScaleSetName': self._serialize.url("vm_scale_set_name", vm_scale_set_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_set_orchestration_service_state.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/setOrchestrationServiceState'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_sizes_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_sizes_operations.py new file mode 100644 index 0000000000000..a846df7d7d8db --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machine_sizes_operations.py @@ -0,0 +1,118 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class VirtualMachineSizesOperations(object): + """VirtualMachineSizesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + location, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + """This API is deprecated. Use `Resources Skus `_. + + :param location: The location upon which virtual-machine-sizes is queried. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineSizeListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes'} # type: ignore diff --git a/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machines_operations.py b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machines_operations.py new file mode 100644 index 0000000000000..6ef45feff67ee --- /dev/null +++ b/sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_03_01/operations/_virtual_machines_operations.py @@ -0,0 +1,2518 @@ +# 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class VirtualMachinesOperations(object): + """VirtualMachinesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.compute.v2021_03_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_location( + self, + location, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.VirtualMachineListResult"] + """Gets all the virtual machines under the specified subscription for the specified location. + + :param location: The location for which virtual machines under the subscription are queried. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_location.metadata['url'] # type: ignore + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str', pattern=r'^[-\w\._]+$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_location.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines'} # type: ignore + + def _capture_initial( + self, + resource_group_name, # type: str + vm_name, # type: str + parameters, # type: "_models.VirtualMachineCaptureParameters" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.VirtualMachineCaptureResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.VirtualMachineCaptureResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._capture_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VirtualMachineCaptureParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('VirtualMachineCaptureResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _capture_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + + def begin_capture( + self, + resource_group_name, # type: str + vm_name, # type: str + parameters, # type: "_models.VirtualMachineCaptureParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.VirtualMachineCaptureResult"] + """Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used + to create similar VMs. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param parameters: Parameters supplied to the Capture Virtual Machine operation. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineCaptureParameters + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 VirtualMachineCaptureResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineCaptureResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineCaptureResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._capture_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualMachineCaptureResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_capture.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + vm_name, # type: str + parameters, # type: "_models.VirtualMachine" + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualMachine" + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VirtualMachine') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, 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, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + vm_name, # type: str + parameters, # type: "_models.VirtualMachine" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.VirtualMachine"] + """The operation to create or update a virtual machine. Please note some properties can be set + only during virtual machine creation. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param parameters: Parameters supplied to the Create Virtual Machine operation. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachine + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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.compute.v2021_03_01.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualMachine', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + vm_name, # type: str + parameters, # type: "_models.VirtualMachineUpdate" + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualMachine" + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VirtualMachineUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + 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.Compute/virtualMachines/{vmName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + vm_name, # type: str + parameters, # type: "_models.VirtualMachineUpdate" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.VirtualMachine"] + """The operation to update a virtual machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param parameters: Parameters supplied to the Update Virtual Machine operation. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineUpdate + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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.compute.v2021_03_01.models.VirtualMachine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualMachine', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + vm_name, # type: str + force_deletion=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if force_deletion is not None: + query_parameters['forceDeletion'] = self._serialize.query("force_deletion", force_deletion, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + vm_name, # type: str + force_deletion=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """The operation to delete a virtual machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param force_deletion: Optional parameter to force delete virtual machines.(Feature in + Preview). + :type force_deletion: 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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + force_deletion=force_deletion, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + vm_name, # type: str + expand=None, # type: Optional[Union[str, "_models.InstanceViewTypes"]] + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualMachine" + """Retrieves information about the model view or the instance view of a virtual machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param expand: The expand expression to apply on the operation. + :type expand: str or ~azure.mgmt.compute.v2021_03_01.models.InstanceViewTypes + :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.compute.v2021_03_01.models.VirtualMachine + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachine"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, 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.Compute/virtualMachines/{vmName}'} # type: ignore + + def instance_view( + self, + resource_group_name, # type: str + vm_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.VirtualMachineInstanceView" + """Retrieves information about the run-time state of a virtual machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VirtualMachineInstanceView, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineInstanceView + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineInstanceView"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.instance_view.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VirtualMachineInstanceView', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + instance_view.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/instanceView'} # type: ignore + + def _convert_to_managed_disks_initial( + self, + resource_group_name, # type: str + vm_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._convert_to_managed_disks_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _convert_to_managed_disks_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks'} # type: ignore + + def begin_convert_to_managed_disks( + self, + resource_group_name, # type: str + vm_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop- + deallocated before invoking this operation. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._convert_to_managed_disks_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_convert_to_managed_disks.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/convertToManagedDisks'} # type: ignore + + def _deallocate_initial( + self, + resource_group_name, # type: str + vm_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._deallocate_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _deallocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + + def begin_deallocate( + self, + resource_group_name, # type: str + vm_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Shuts down the virtual machine and releases the compute resources. You are not billed for the + compute resources that this virtual machine uses. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._deallocate_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_deallocate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/deallocate'} # type: ignore + + def generalize( + self, + resource_group_name, # type: str + vm_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Sets the OS state of the virtual machine to generalized. It is recommended to sysprep the + virtual machine before performing this operation. :code:`
    `For Windows, please refer to + `Create a managed image of a generalized VM in Azure `_.:code:`
    `For Linux, please refer + to `How to create an image of a virtual machine or VHD `_. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_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 + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self.generalize.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + generalize.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/generalize'} # type: ignore + + def list( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.VirtualMachineListResult"] + """Lists all of the virtual machines in the specified resource group. Use the nextLink property in + the response to get the next page of virtual machines. + + :param resource_group_name: The name of the resource group. + :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 VirtualMachineListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + + def list_all( + self, + status_only=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.VirtualMachineListResult"] + """Lists all of the virtual machines in the specified subscription. Use the nextLink property in + the response to get the next page of virtual machines. + + :param status_only: statusOnly=true enables fetching run time status of all Virtual Machines in + the subscription. + :type status_only: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_all.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if status_only is not None: + query_parameters['statusOnly'] = self._serialize.query("status_only", status_only, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('VirtualMachineListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachines'} # type: ignore + + def list_available_sizes( + self, + resource_group_name, # type: str + vm_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.VirtualMachineSizeListResult"] + """Lists all available virtual machine sizes to which the specified virtual machine can be + resized. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VirtualMachineSizeListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_03_01.models.VirtualMachineSizeListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineSizeListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_available_sizes.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('VirtualMachineSizeListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_available_sizes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/vmSizes'} # type: ignore + + def _power_off_initial( + self, + resource_group_name, # type: str + vm_name, # type: str + skip_shutdown=False, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._power_off_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if skip_shutdown is not None: + query_parameters['skipShutdown'] = self._serialize.query("skip_shutdown", skip_shutdown, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _power_off_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + + def begin_power_off( + self, + resource_group_name, # type: str + vm_name, # type: str + skip_shutdown=False, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """The operation to power off (stop) a virtual machine. The virtual machine can be restarted with + the same provisioned resources. You are still charged for this virtual machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param skip_shutdown: The parameter to request non-graceful VM shutdown. True value for this + flag indicates non-graceful shutdown whereas false indicates otherwise. Default value for this + flag is false if not specified. + :type skip_shutdown: 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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._power_off_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + skip_shutdown=skip_shutdown, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_power_off.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/powerOff'} # type: ignore + + def _reapply_initial( + self, + resource_group_name, # type: str + vm_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self._reapply_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reapply_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply'} # type: ignore + + def begin_reapply( + self, + resource_group_name, # type: str + vm_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """The operation to reapply a virtual machine's state. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._reapply_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_reapply.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reapply'} # type: ignore + + def _restart_initial( + self, + resource_group_name, # type: str + vm_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._restart_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + + def begin_restart( + self, + resource_group_name, # type: str + vm_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """The operation to restart a virtual machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._restart_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/restart'} # type: ignore + + def _start_initial( + self, + resource_group_name, # type: str + vm_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._start_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + + def begin_start( + self, + resource_group_name, # type: str + vm_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """The operation to start a virtual machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._start_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/start'} # type: ignore + + def _redeploy_initial( + self, + resource_group_name, # type: str + vm_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._redeploy_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _redeploy_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + + def begin_redeploy( + self, + resource_group_name, # type: str + vm_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Shuts down the virtual machine, moves it to a new node, and powers it back on. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._redeploy_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_redeploy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/redeploy'} # type: ignore + + def _reimage_initial( + self, + resource_group_name, # type: str + vm_name, # type: str + parameters=None, # type: Optional["_models.VirtualMachineReimageParameters"] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._reimage_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if parameters is not None: + body_content = self._serialize.body(parameters, 'VirtualMachineReimageParameters') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage'} # type: ignore + + def begin_reimage( + self, + resource_group_name, # type: str + vm_name, # type: str + parameters=None, # type: Optional["_models.VirtualMachineReimageParameters"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Reimages the virtual machine which has an ephemeral OS disk back to its initial state. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param parameters: Parameters supplied to the Reimage Virtual Machine operation. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineReimageParameters + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._reimage_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/reimage'} # type: ignore + + def retrieve_boot_diagnostics_data( + self, + resource_group_name, # type: str + vm_name, # type: str + sas_uri_expiration_time_in_minutes=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> "_models.RetrieveBootDiagnosticsDataResult" + """The operation to retrieve SAS URIs for a virtual machine's boot diagnostic logs. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param sas_uri_expiration_time_in_minutes: Expiration duration in minutes for the SAS URIs with + a value between 1 to 1440 minutes. :code:`
    `:code:`
    `NOTE: If not specified, SAS URIs + will be generated with a default expiration duration of 120 minutes. + :type sas_uri_expiration_time_in_minutes: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RetrieveBootDiagnosticsDataResult, or the result of cls(response) + :rtype: ~azure.mgmt.compute.v2021_03_01.models.RetrieveBootDiagnosticsDataResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RetrieveBootDiagnosticsDataResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self.retrieve_boot_diagnostics_data.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if sas_uri_expiration_time_in_minutes is not None: + query_parameters['sasUriExpirationTimeInMinutes'] = self._serialize.query("sas_uri_expiration_time_in_minutes", sas_uri_expiration_time_in_minutes, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RetrieveBootDiagnosticsDataResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + retrieve_boot_diagnostics_data.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/retrieveBootDiagnosticsData'} # type: ignore + + def _perform_maintenance_initial( + self, + resource_group_name, # type: str + vm_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self._perform_maintenance_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _perform_maintenance_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance'} # type: ignore + + def begin_perform_maintenance( + self, + resource_group_name, # type: str + vm_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """The operation to perform maintenance on a virtual machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._perform_maintenance_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_perform_maintenance.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/performMaintenance'} # type: ignore + + def simulate_eviction( + self, + resource_group_name, # type: str + vm_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """The operation to simulate the eviction of spot virtual machine. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_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 + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + + # Construct URL + url = self.simulate_eviction.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + simulate_eviction.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/simulateEviction'} # type: ignore + + def _assess_patches_initial( + self, + resource_group_name, # type: str + vm_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.VirtualMachineAssessPatchesResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.VirtualMachineAssessPatchesResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + accept = "application/json" + + # Construct URL + url = self._assess_patches_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, 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.Compute/virtualMachines/{vmName}/assessPatches'} # type: ignore + + def begin_assess_patches( + self, + resource_group_name, # type: str + vm_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.VirtualMachineAssessPatchesResult"] + """Assess patches on the VM. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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.compute.v2021_03_01.models.VirtualMachineAssessPatchesResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineAssessPatchesResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._assess_patches_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualMachineAssessPatchesResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_assess_patches.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/assessPatches'} # type: ignore + + def _install_patches_initial( + self, + resource_group_name, # type: str + vm_name, # type: str + install_patches_input, # type: "_models.VirtualMachineInstallPatchesParameters" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.VirtualMachineInstallPatchesResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.VirtualMachineInstallPatchesResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._install_patches_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(install_patches_input, 'VirtualMachineInstallPatchesParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, 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.Compute/virtualMachines/{vmName}/installPatches'} # type: ignore + + def begin_install_patches( + self, + resource_group_name, # type: str + vm_name, # type: str + install_patches_input, # type: "_models.VirtualMachineInstallPatchesParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.VirtualMachineInstallPatchesResult"] + """Installs patches on the VM. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param install_patches_input: Input for InstallPatches as directly received by the API. + :type install_patches_input: ~azure.mgmt.compute.v2021_03_01.models.VirtualMachineInstallPatchesParameters + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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.compute.v2021_03_01.models.VirtualMachineInstallPatchesResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VirtualMachineInstallPatchesResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._install_patches_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + install_patches_input=install_patches_input, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('VirtualMachineInstallPatchesResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_install_patches.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/installPatches'} # type: ignore + + def _run_command_initial( + self, + resource_group_name, # type: str + vm_name, # type: str + parameters, # type: "_models.RunCommandInput" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.RunCommandResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RunCommandResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-03-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json, text/json" + + # Construct URL + url = self._run_command_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'RunCommandInput') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RunCommandResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _run_command_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand'} # type: ignore + + def begin_run_command( + self, + resource_group_name, # type: str + vm_name, # type: str + parameters, # type: "_models.RunCommandInput" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.RunCommandResult"] + """Run command on the VM. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param vm_name: The name of the virtual machine. + :type vm_name: str + :param parameters: Parameters supplied to the Run command operation. + :type parameters: ~azure.mgmt.compute.v2021_03_01.models.RunCommandInput + :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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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 RunCommandResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.compute.v2021_03_01.models.RunCommandResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RunCommandResult"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._run_command_initial( + resource_group_name=resource_group_name, + vm_name=vm_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('RunCommandResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vmName': self._serialize.url("vm_name", vm_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = 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 + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_run_command.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand'} # type: ignore